text
stringlengths 0
3.34M
|
---|
module EffCont
data Exists : List a -> a -> Type where
Here : Exists (x :: xs) x
There : Exists xs x -> Exists (y :: xs) x
data Effect : List (Type -> Type) -> Type -> Type where
Pure : a -> Effect xs a
EffectC : {f : Type -> Type} -> Exists xs f -> f a -> Effect xs a
data Eff : List (Type -> Type) -> Type -> Type where
Cont : ({r : Type} -> (a -> r) -> ({x : Type} -> Effect xs x -> (x -> r) -> r) -> r) -> Eff xs a
pure : a -> Eff xs a
pure x = Cont (\k, imp => imp (Pure x) k)
(>>=) : Eff xs a -> (a -> Eff xs b) -> Eff xs b
(>>=) (Cont g) f = Cont (\k, imp => g (\x => let (Cont g') = f x in g' k imp) imp)
-- State effect
data State : (s : Type) -> Type -> Type where
Get : State s s
Put : s -> State s ()
get : {auto e : Exists xs (State s)} -> Eff xs s
get {e} = Cont (\k, imp => imp (EffectC e Get) k)
put : {auto e : Exists xs (State s)} -> s -> Eff xs ()
put {e} s = Cont (\k, imp => imp (EffectC e (Put s)) k)
-- Reader effect
data Reader : (e : Type) -> Type -> Type where
Ask : Reader e e
ask : {auto e : Exists xs (Reader en)} -> Eff xs en
ask {e} = Cont (\k, imp => imp (EffectC e Ask) k)
-- Interpreters
runPure : Effect [] x -> (x -> r) -> r
runPure (Pure x) k = k x
runPure (EffectC Here _) _ impossible
runPure (EffectC (There _) _) _ impossible
stateImp : State s x -> (x -> s -> r) -> s -> r
stateImp Get k st = k st st
stateImp (Put st') k st = k () st'
runState : (Effect xs x -> (x -> r) -> r) -> Effect (State s :: xs) x -> (x -> s -> r) -> s -> r
runState k (Pure x) k' = k' x
runState k (EffectC Here effect) k' = stateImp effect k'
runState k (EffectC (There xs) fa) k' = \st => k (EffectC xs fa) (\x => k' x st)
readerImp : Reader e x -> (x -> e -> r) -> e -> r
readerImp Ask k e = k e e
runReader : (Effect xs x -> (x -> r) -> r) -> Effect (Reader e :: xs) x -> (x -> e -> r) -> e -> r
runReader k (Pure x) k' = k' x
runReader k (EffectC Here effect) k' = readerImp effect k'
runReader k (EffectC (There xs) fa) k' = \e => k (EffectC xs fa) (\x => k' x e)
run : (a -> r) -> ({x : Type} -> Effect xs x -> (x -> r) -> r) -> Eff xs a -> r
run k imp (Cont f) = f k imp
example : Eff [State Int, Reader Int] Int
example = do s <- get
put (s + 1)
s <- get
a <- ask
pure (s + a)
test : (Int, Int, Int)
test = let f = run (\x, s, e => (x, s, e)) (\eff, k => runState (runReader runPure) eff k) example in f 1 2
|
struct FullOrbitPath{T<:Number}
dt::Union{T,Vector{T}}
r::Vector{T}
phi::Vector{T}
z::Vector{T}
vr::Vector{T}
vphi::Vector{T}
vz::Vector{T}
end
mutable struct FullOrbitStatus
errcode::Int
end
FullOrbitStatus() = FullOrbitStatus(1)
function FullOrbitPath(T::DataType=Float64)
FullOrbitPath(zero(T),T[],T[],T[],T[],T[],T[])
end
Base.length(op::FullOrbitPath) = length(op.r)
function borispush(M, m, q, v, u, dt)
x = u[1]
y = u[2]
z = u[3]
q_m_half_dt = (0.5*dt*q*e0/m)
B, E = fields(M,x,y,z)
t = q_m_half_dt*B
half_acc = q_m_half_dt*E
v_minus = v .+ half_acc
v_minus_x_t = cross(v_minus,t)
v_prime = v_minus + v_minus_x_t
s = (2.0/(1+dot(t,t)))*t
v_prime_x_s = cross(v_prime,s)
v_plus = v_minus + v_prime_x_s
v = v_plus .+ half_acc
return v
end
"""
integrate(M, pc::Particle; dt=0.01, tmax=1000) -> FullOrbitPath, stat
Integrate the particle up to tmax normalized to the cyclotron_period with time step dt is a fraction of a cyclotron period. Default tmax is 1000
"""
function integrate(M::AbstractEquilibrium, pc::Particle; dt= 0.01, tmax = 1000)
if lorentz_factor(pc) > 1.05
@warn "Relativistic Full Orbit has not been implemented: Lorentz factor > 1.05"
end
T_c = cyclotron_period(M,pc)
dt_sec = dt*T_c
tmax_sec = tmax*T_c
t = 0:dt:tmax
nstep = length(t)
x_arr = zeros(nstep)
y_arr = zeros(nstep)
z_arr = zeros(nstep)
vx_arr = zeros(nstep+1)
vy_arr = zeros(nstep+1)
vz_arr = zeros(nstep+1)
sp, cp = sincos(pc.phi)
u = SVector{3}([pc.r*cp,pc.r*sp,pc.z])
v = SVector{3}([pc.vr*cp - pc.vt*sp,pc.vr*sp + pc.vt*cp,pc.vz])
x_arr[1] = u[1]
y_arr[1] = u[2]
z_arr[1] = u[3]
v = borispush(M,pc.m,pc.q,v,u,-0.5*dt_sec)
vx_arr[1] = v[1]
vy_arr[1] = v[2]
vz_arr[1] = v[3]
for i=2:nstep
v = borispush(M,pc.m,pc.q,v,u,dt_sec)
x_arr[i] = x_arr[i-1] + v[1]*dt_sec
y_arr[i] = y_arr[i-1] + v[2]*dt_sec
z_arr[i] = z_arr[i-1] + v[3]*dt_sec
u = SVector{3}(x_arr[i],y_arr[i],z_arr[i])
vx_arr[i] = v[1]
vy_arr[i] = v[2]
vz_arr[i] = v[3]
end
v = borispush(M,pc.m,pc.q,v,u,0.5*dt_sec)
vx_arr[end] = v[1]
vy_arr[end] = v[2]
vz_arr[end] = v[3]
r_arr = sqrt.(x_arr.^2 .+ y_arr.^2)
phi_arr = atan.(y_arr,x_arr)
sp = sin.(phi_arr)
cp = cos.(phi_arr)
#velocity is 0.5 step behind position
vr_arr = [0.5*(vx_arr[i]+vx_arr[i+1])*cp[i] .+ 0.5*(vy_arr[i] + vy_arr[i+1])*sp[i] for i=1:nstep]
vphi_arr = [-0.5*(vx_arr[i]+vx_arr[i+1])*sp[i] .+ 0.5*(vy_arr[i] + vy_arr[i+1])*cp[i] for i=1:nstep]
vz_arr = [0.5(vz_arr[i] + vz_arr[i+1]) for i=1:nstep]
return FullOrbitPath(dt_sec, r_arr, phi_arr,z_arr,vr_arr,vphi_arr,vz_arr), FullOrbitStatus(0)
end
"""
get_full_orbit(M, pc::Particle; dt=T_c/100, tmax=1000*T_c) -> FullOrbitPath, stat
Integrate the full orbit up to tmax (μs) with time step dt (μs). Default tmax is 1000*cyclotron_period.
"""
function get_full_orbit(M::AbstractEquilibrium, pc::Particle; kwargs...)
return integrate(M, pc; kwargs...)
end
"""
get_full_orbit(M, gcp::GCParticle; dt=T_c/100, tmax=1000*T_c) -> FullOrbitPath, stat
Integrate the full orbit up to tmax (μs) with time step dt (μs). Default tmax is 1000*cyclotron_period.
"""
function get_full_orbit(M::AbstractEquilibrium, gcp::GCParticle; gamma = 0.0, verbose=false, kwargs...)
v = velocity(M, gcp, gamma)
r_gyro = gyro_step(M, gcp, gamma)
verbose && println("|r_gyro|: $(norm(r_gyro))")
r_p = SVector{3}(gcp.r, zero(gcp.r), gcp.z) .- r_gyro
r = norm(r_p[1:2])
phi = atan(r_p[2],r_p[1])
z = r_p[3]
sp,cp = sincos(phi)
vr = v[1]*cp + v[2]*sp
vphi = -v[1]*sp + v[2]*cp
vz = v[3]
pc = Particle(r,phi,z,vr,vphi,vz,gcp.m,gcp.q)
return integrate(M, pc::Particle; kwargs...)
end
function hits_wall(M, pc::Particle, wall; dt=1e-3, tmax=100)
dt_sec = dt*1e-6
t = 0:dt:tmax
nstep = length(t)
sp,cp = sincos(pc.phi)
u = SVector{3}([pc.r*cp,pc.r*sp,z])
v = SVector{3}([pc.vr*cp - pc.vt*sp, pc.vr*sp + pc.vt*cp,pc.vz])
hit = false
v = borispush(M,pc.m,pc.q,v,u,-0.5*dt_sec)
T = 0.0
for i=1:nstep
v = borispush(M,pc.m,pc.q,v,u,dt_sec)
u = u .+ v*dt_sec
rr = sqrt(u[1]^2 + u[2]^2)
zz = u[3]
if ~in_vessel(wall,(rr,zz))
hit = true
break
end
T += dt_sec
end
return hit, T
end
|
Ever looked at a woman with gorgeous hair and wondered what type of hair care products she uses? If so, then trust us when we say that we’ve all been there. Everyone at some point or the other in their lives has come across women with stunning hair and wondered what they do every day to keep their hair healthy, great-looking and free of unsightly problems like dandruff and hair thinning.
Nowadays, women are troubled with various hair concerns that make their precious locks look dull and lifeless. They often go to great lengths, from pricey salon sessions to trying professional hair care products, to restore natural beauty to their mane. However, instead of splurging money on these things, you could just try doing simple-yet-powerful things to improve the texture and appearance of your locks.
One thing that every woman with great hair can vouch for is the importance of using gentle hair care products. There are a plethora of hair care products available in the beauty stores these days. However, not all of them benefit your hair. In fact, there are tons of hair care products that contain harsh chemicals capable of doing more harm than good to your hair. Using harsh hair care products can strip your hair of its natural oil and leave it looking dry and dull. Whether it is a hair serum or your everyday shampoo and conditioner, it is imperative to buy products that are gentle and do not contain harsh compounds.
Heat-styling tools like straighteners and curling irons are true favorites for hair styling purposes. There is no denying the fact that using these tools can leave your hair looking well-styled and pretty. However, over-using these tools can cause severe damage to the texture of your hair can make them become rough and frizzy. The heat from these tools adversely affects the hair follicles on your scalp and leads to various unsightly problems. To prevent that from happening, it is important to avoid using heat-styling tools every day. Most women who have naturally gorgeous hair stay away from heat-styling tools. While using them every once in a while is not that harmful, daily use of these tools is a complete no-no for maintaining the health and beauty of hair.
Women with great hair are aware of the ways in which exposure to the sun can damage their hair. The UVA and UVB rays emitted by the sun are not just bad for your skin but they are equally harmful to your hair. Experts have found that prolonged exposure can cause the hair to appear dry and rough and lead to premature greying of hair. To safeguard your hair from the damaging effects of the sun, try to cover up your hair with a scarf while out in the sun and use sun-protective hair care products.
Women who have beautiful hair use wide-tooth wooden combs. There are plenty of ways in which switching your regular plastic combs with a wooden comb can benefit your hair. Brushing the hair with a wooden comb stimulates blood circulation in the scalp and encourages hair growth. It also nourishes your hair and prevents flyaways. When compared to plastic and metal combs, wooden combs do not cause breakage and prevent hair from becoming frizzy.
Another thing that is common among women with stunning hair is the habit of sleeping on a satin pillowcase. This simple everyday habits can transform the way you’re your hair looks. The softness of satin prevents the development of friction in the hair. Sleeping on a satin pillowcase can help you wake up with soft, smooth and frizz-free locks.
Another thing that women with great hair do every day is to keep their mane clean. It is a commonly known fact that keeping hair and scalp clean is essential for its health and appearance. By doing so, you will be able to ward off residue-buildup in the scalp that further leads to a wide range of issues like dandruff, hair loss and itchy scalp. On a daily basis, your hair gets exposed to the toxic elements in the air along with dust and dirt. These substances settle in your scalp and if not cleaned in due time, they can lead to various troubling hair problems. To avoid that from happening, follow what women with enviable hair do and keep your locks clean.
Instead of using heat-styling tools, women with great hair use styling products like hair serums to beautify and add shine to their tresses. Just a dollop of a hair serum can leave your hair looking well-styled, shiny and smooth. There are plenty of hair serums available in the stores. Pick a hair serum that is especially developed for your hair type, whether oily or dry and use it to style your hair. Do this every day to flaunt picture-perfect mane.
|
"""
多边形
"""
abstract type AbstractPolygon{T} end
|
module Solutions.Day2
import Common
import Parser
data Direction = Up Integer
| Down Integer
| Forward Integer
Position : Type
Position = (Integer, Integer)
PositionAim : Type
PositionAim = (Integer, Position)
pairToDirection : (String, Integer) -> Maybe Direction
pairToDirection ("up", num) = Just (Up num)
pairToDirection ("down", num) = Just (Down num)
pairToDirection ("forward", num) = Just (Forward num)
pairToDirection (_, num) = Nothing
parseDirections : Parser (List Direction)
parseDirections = pLines $ mapM pairToDirection (pWord' <&> pInteger)
move : Position -> Direction -> Position
move (x, z) (Up y) = (x, z-y)
move (x, z) (Down y) = (x, z+y)
move (x, z) (Forward y) = (x+y, z)
aimMove : PositionAim -> Direction -> PositionAim
aimMove (aim, (hor, ver)) (Up y) = (aim-y, (hor, ver))
aimMove (aim, (hor, ver)) (Down y) = (aim+y, (hor, ver))
aimMove (aim, (hor, ver)) (Forward y) = (aim, (hor+y, ver + aim*y))
doMoves : (a -> Direction -> a) -> a -> List Direction -> a
doMoves mover start moves = foldl mover start moves
answer : (Integer, Integer) -> Integer
answer (x, y) = x * y
export
run : Solution
run input = do
moves <- eitherParse parseDirections input
let sol1 = show . answer $ doMoves move (0,0) moves
let sol2 = show . answer . snd$ doMoves aimMove (0, (0,0)) moves
Right (sol1, sol2)
|
<a href="https://www.bigdatauniversity.com"></a>
# <center>Non Linear Regression Analysis</center>
If the data shows a curvy trend, then linear regression will not produce very accurate results when compared to a non-linear regression because, as the name implies, linear regression presumes that the data is linear.
Let's learn about non linear regressions and apply an example on python. In this notebook, we fit a non-linear model to the datapoints corrensponding to China's GDP from 1960 to 2014.
### Importing required libraries
```python
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
```
Though Linear regression is very good to solve many problems, it cannot be used for all datasets. First recall how linear regression, could model a dataset. It models a linear relation between a dependent variable y and independent variable x. It had a simple equation, of degree 1, for example y = 2*(x) + 3.
```python
x = np.arange(-5.0, 5.0, 0.1)
##You can adjust the slope and intercept to verify the changes in the graph
y = 2*(x) + 3
y_noise = 2 * np.random.normal(size=x.size)
ydata = y + y_noise
#plt.figure(figsize=(8,6))
plt.plot(x, ydata, 'bo')
plt.plot(x,y, 'r')
plt.ylabel('Dependent Variable')
plt.xlabel('Indepdendent Variable')
plt.show()
```
Non-linear regressions are a relationship between independent variables $x$ and a dependent variable $y$ which result in a non-linear function modeled data. Essentially any relationship that is not linear can be termed as non-linear, and is usually represented by the polynomial of $k$ degrees (maximum power of $x$).
$$ \ y = a x^3 + b x^2 + c x + d \ $$
Non-linear functions can have elements like exponentials, logarithms, fractions, and others. For example: $$ y = \log(x)$$
Or even, more complicated such as :
$$ y = \log(a x^3 + b x^2 + c x + d)$$
Let's take a look at a cubic function's graph.
```python
x = np.arange(-5.0, 5.0, 0.1)
##You can adjust the slope and intercept to verify the changes in the graph
y = 1*(x**3) + 1*(x**2) + 1*x + 3
y_noise = 20 * np.random.normal(size=x.size)
ydata = y + y_noise
plt.plot(x, ydata, 'bo')
plt.plot(x,y, 'r')
plt.ylabel('Dependent Variable')
plt.xlabel('Indepdendent Variable')
plt.show()
```
As you can see, this function has $x^3$ and $x^2$ as independent variables. Also, the graphic of this function is not a straight line over the 2D plane. So this is a non-linear function.
Some other types of non-linear functions are:
### Quadratic
$$ Y = X^2 $$
```python
x = np.arange(-5.0, 5.0, 0.1)
##You can adjust the slope and intercept to verify the changes in the graph
y = np.power(x,2)
y_noise = 2 * np.random.normal(size=x.size)
ydata = y + y_noise
plt.plot(x, ydata, 'bo')
plt.plot(x,y, 'r')
plt.ylabel('Dependent Variable')
plt.xlabel('Indepdendent Variable')
plt.show()
```
### Exponential
An exponential function with base c is defined by $$ Y = a + b c^X$$ where b ≠0, c > 0 , c ≠1, and x is any real number. The base, c, is constant and the exponent, x, is a variable.
```python
X = np.arange(-5.0, 5.0, 0.1)
##You can adjust the slope and intercept to verify the changes in the graph
Y= np.exp(X)
plt.plot(X,Y)
plt.ylabel('Dependent Variable')
plt.xlabel('Indepdendent Variable')
plt.show()
```
### Logarithmic
The response $y$ is a results of applying logarithmic map from input $x$'s to output variable $y$. It is one of the simplest form of __log()__: i.e. $$ y = \log(x)$$
Please consider that instead of $x$, we can use $X$, which can be polynomial representation of the $x$'s. In general form it would be written as
\begin{equation}
y = \log(X)
\end{equation}
```python
X = np.arange(-5.0, 5.0, 0.1)
Y = np.log(X)
plt.plot(X,Y)
plt.ylabel('Dependent Variable')
plt.xlabel('Indepdendent Variable')
plt.show()
```
### Sigmoidal/Logistic
$$ Y = a + \frac{b}{1+ c^{(X-d)}}$$
```python
X = np.arange(-5.0, 5.0, 0.1)
Y = 1-4/(1+np.power(3, X-2))
plt.plot(X,Y)
plt.ylabel('Dependent Variable')
plt.xlabel('Indepdendent Variable')
plt.show()
```
<a id="ref2"></a>
# Non-Linear Regression example
For an example, we're going to try and fit a non-linear model to the datapoints corrensponding to China's GDP from 1960 to 2014. We download a dataset with two columns, the first, a year between 1960 and 2014, the second, China's corresponding annual gross domestic income in US dollars for that year.
```python
import numpy as np
import pandas as pd
#downloading dataset
!wget -nv -O china_gdp.csv https://s3-api.us-geo.objectstorage.softlayer.net/cf-courses-data/CognitiveClass/ML0101ENv3/labs/china_gdp.csv
df = pd.read_csv("china_gdp.csv")
df.head(10)
```
'wget' n'est pas reconnu en tant que commande interne
ou externe, un programme ex‚cutable ou un fichier de commandes.
<div>
<style scoped>
.dataframe tbody tr th:only-of-type {
vertical-align: middle;
}
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>Year</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>1960</td>
<td>5.918412e+10</td>
</tr>
<tr>
<th>1</th>
<td>1961</td>
<td>4.955705e+10</td>
</tr>
<tr>
<th>2</th>
<td>1962</td>
<td>4.668518e+10</td>
</tr>
<tr>
<th>3</th>
<td>1963</td>
<td>5.009730e+10</td>
</tr>
<tr>
<th>4</th>
<td>1964</td>
<td>5.906225e+10</td>
</tr>
<tr>
<th>5</th>
<td>1965</td>
<td>6.970915e+10</td>
</tr>
<tr>
<th>6</th>
<td>1966</td>
<td>7.587943e+10</td>
</tr>
<tr>
<th>7</th>
<td>1967</td>
<td>7.205703e+10</td>
</tr>
<tr>
<th>8</th>
<td>1968</td>
<td>6.999350e+10</td>
</tr>
<tr>
<th>9</th>
<td>1969</td>
<td>7.871882e+10</td>
</tr>
</tbody>
</table>
</div>
__Did you know?__ When it comes to Machine Learning, you will likely be working with large datasets. As a business, where can you host your data? IBM is offering a unique opportunity for businesses, with 10 Tb of IBM Cloud Object Storage: [Sign up now for free](http://cocl.us/ML0101EN-IBM-Offer-CC)
### Plotting the Dataset ###
This is what the datapoints look like. It kind of looks like an either logistic or exponential function. The growth starts off slow, then from 2005 on forward, the growth is very significant. And finally, it deaccelerates slightly in the 2010s.
```python
plt.figure(figsize=(8,5))
x_data, y_data = (df["Year"].values, df["Value"].values)
plt.plot(x_data, y_data, 'ro')
plt.ylabel('GDP')
plt.xlabel('Year')
plt.show()
```
### Choosing a model ###
From an initial look at the plot, we determine that the logistic function could be a good approximation,
since it has the property of starting with a slow growth, increasing growth in the middle, and then decreasing again at the end; as illustrated below:
```python
X = np.arange(-5.0, 5.0, 0.1)
Y = 1.0 / (1.0 + np.exp(-X))
plt.plot(X,Y)
plt.ylabel('Dependent Variable')
plt.xlabel('Indepdendent Variable')
plt.show()
```
The formula for the logistic function is the following:
$$ \hat{Y} = \frac1{1+e^{\beta_1(X-\beta_2)}}$$
$\beta_1$: Controls the curve's steepness,
$\beta_2$: Slides the curve on the x-axis.
### Building The Model ###
Now, let's build our regression model and initialize its parameters.
```python
def sigmoid(x, Beta_1, Beta_2):
y = 1 / (1 + np.exp(-Beta_1*(x-Beta_2)))
return y
```
Lets look at a sample sigmoid line that might fit with the data:
```python
beta_1 = 0.10
beta_2 = 1990.0
#logistic function
Y_pred = sigmoid(X, beta_1 , beta_2)
#plot initial prediction against datapoints
plt.plot(X, Y*15000000000000.)
plt.plot(X, Y, 'ro')
```
Our task here is to find the best parameters for our model. Lets first normalize our x and y:
```python
# Lets normalize our data
xdata =X/max(X)
ydata =Y/max(Y)
```
#### How we find the best parameters for our fit line?
we can use __curve_fit__ which uses non-linear least squares to fit our sigmoid function, to data. Optimal values for the parameters so that the sum of the squared residuals of sigmoid(xdata, *popt) - ydata is minimized.
popt are our optimized parameters.
```python
from scipy.optimize import curve_fit
popt, pcov = curve_fit(sigmoid, xdata, ydata)
#print the final parameters
print(" beta_1 = %f, beta_2 = %f" % (popt[0], popt[1]))
```
beta_1 = 4.978100, beta_2 = -0.004434
Now we plot our resulting regresssion model.
```python
x = np.linspace(1960, 2015, 55)
x = x/max(x)
plt.figure(figsize=(8,5))
y = sigmoid(x, *popt)
plt.plot(xdata, ydata, 'ro', label='data')
plt.plot(x,y, linewidth=3.0, label='fit')
plt.legend(loc='best')
plt.ylabel('GDP')
plt.xlabel('Year')
plt.show()
```
## Practice
Can you calculate what is the accuracy of our model?
```python
# write your code here
# split data into train/test
msk = np.random.rand(len(df)) < 0.8
train_x = xdata[msk]
test_x = xdata[~msk]
train_y = ydata[msk]
test_y = ydata[~msk]
# build the model using train set
popt, pcov = curve_fit(sigmoid, train_x, train_y)
# predict using test set
y_hat = sigmoid(test_x, *popt)
# evaluation
print("Mean absolute error: %.2f" % np.mean(np.absolute(y_hat - test_y)))
print("Residual sum of squares (MSE): %.2f" % np.mean((y_hat - test_y) ** 2))
from sklearn.metrics import r2_score
print("R2-score: %.2f" % r2_score(y_hat , test_y) )
```
Double-click __here__ for the solution.
<!-- Your answer is below:
# split data into train/test
msk = np.random.rand(len(df)) < 0.8
train_x = xdata[msk]
test_x = xdata[~msk]
train_y = ydata[msk]
test_y = ydata[~msk]
# build the model using train set
popt, pcov = curve_fit(sigmoid, train_x, train_y)
# predict using test set
y_hat = sigmoid(test_x, *popt)
# evaluation
print("Mean absolute error: %.2f" % np.mean(np.absolute(y_hat - test_y)))
print("Residual sum of squares (MSE): %.2f" % np.mean((y_hat - test_y) ** 2))
from sklearn.metrics import r2_score
print("R2-score: %.2f" % r2_score(y_hat , test_y) )
-->
## Want to learn more?
IBM SPSS Modeler is a comprehensive analytics platform that has many machine learning algorithms. It has been designed to bring predictive intelligence to decisions made by individuals, by groups, by systems – by your enterprise as a whole. A free trial is available through this course, available here: [SPSS Modeler](http://cocl.us/ML0101EN-SPSSModeler).
Also, you can use Watson Studio to run these notebooks faster with bigger datasets. Watson Studio is IBM's leading cloud solution for data scientists, built by data scientists. With Jupyter notebooks, RStudio, Apache Spark and popular libraries pre-packaged in the cloud, Watson Studio enables data scientists to collaborate on their projects without having to install anything. Join the fast-growing community of Watson Studio users today with a free account at [Watson Studio](https://cocl.us/ML0101EN_DSX)
### Thanks for completing this lesson!
Notebook created by: <a href = "https://ca.linkedin.com/in/saeedaghabozorgi">Saeed Aghabozorgi</a>
<hr>
Copyright © 2018 [Cognitive Class](https://cocl.us/DX0108EN_CC). This notebook and its source code are released under the terms of the [MIT License](https://bigdatauniversity.com/mit-license/).
|
State Before: α : Type u_1
β : Type ?u.3903
f fa : α → α
fb : β → β
x y : α
m n : ℕ
hm : IsPeriodicPt f m x
hn : IsPeriodicPt f n x
⊢ IsPeriodicPt f (Nat.gcd m n) x State After: α : Type u_1
β : Type ?u.3903
f fa : α → α
fb : β → β
x y : α
m n : ℕ
⊢ IsPeriodicPt f m x → IsPeriodicPt f n x → IsPeriodicPt f (Nat.gcd m n) x Tactic: revert hm hn State Before: α : Type u_1
β : Type ?u.3903
f fa : α → α
fb : β → β
x y : α
m n : ℕ
⊢ IsPeriodicPt f m x → IsPeriodicPt f n x → IsPeriodicPt f (Nat.gcd m n) x State After: case refine'_1
α : Type u_1
β : Type ?u.3903
f fa : α → α
fb : β → β
x y : α
m n✝ n : ℕ
x✝ : IsPeriodicPt f 0 x
hn : IsPeriodicPt f n x
⊢ IsPeriodicPt f (Nat.gcd 0 n) x
case refine'_2
α : Type u_1
β : Type ?u.3903
f fa : α → α
fb : β → β
x y : α
m✝ n✝ m n : ℕ
x✝ : 0 < m
ih : IsPeriodicPt f (n % m) x → IsPeriodicPt f m x → IsPeriodicPt f (Nat.gcd (n % m) m) x
hm : IsPeriodicPt f m x
hn : IsPeriodicPt f n x
⊢ IsPeriodicPt f (Nat.gcd m n) x Tactic: refine' Nat.gcd.induction m n (fun n _ hn => _) fun m n _ ih hm hn => _ State Before: case refine'_1
α : Type u_1
β : Type ?u.3903
f fa : α → α
fb : β → β
x y : α
m n✝ n : ℕ
x✝ : IsPeriodicPt f 0 x
hn : IsPeriodicPt f n x
⊢ IsPeriodicPt f (Nat.gcd 0 n) x State After: no goals Tactic: rwa [Nat.gcd_zero_left] State Before: case refine'_2
α : Type u_1
β : Type ?u.3903
f fa : α → α
fb : β → β
x y : α
m✝ n✝ m n : ℕ
x✝ : 0 < m
ih : IsPeriodicPt f (n % m) x → IsPeriodicPt f m x → IsPeriodicPt f (Nat.gcd (n % m) m) x
hm : IsPeriodicPt f m x
hn : IsPeriodicPt f n x
⊢ IsPeriodicPt f (Nat.gcd m n) x State After: case refine'_2
α : Type u_1
β : Type ?u.3903
f fa : α → α
fb : β → β
x y : α
m✝ n✝ m n : ℕ
x✝ : 0 < m
ih : IsPeriodicPt f (n % m) x → IsPeriodicPt f m x → IsPeriodicPt f (Nat.gcd (n % m) m) x
hm : IsPeriodicPt f m x
hn : IsPeriodicPt f n x
⊢ IsPeriodicPt f (Nat.gcd (n % m) m) x Tactic: rw [Nat.gcd_rec] State Before: case refine'_2
α : Type u_1
β : Type ?u.3903
f fa : α → α
fb : β → β
x y : α
m✝ n✝ m n : ℕ
x✝ : 0 < m
ih : IsPeriodicPt f (n % m) x → IsPeriodicPt f m x → IsPeriodicPt f (Nat.gcd (n % m) m) x
hm : IsPeriodicPt f m x
hn : IsPeriodicPt f n x
⊢ IsPeriodicPt f (Nat.gcd (n % m) m) x State After: no goals Tactic: exact ih (hn.mod hm) hm
|
module AutomotivePOMDPs
using POMDPs
using StatsBase
using Distributions
using POMDPModelTools
using POMDPSimulators
using POMDPPolicies
using BeliefUpdaters
using RLInterface
using Parameters
using GridInterpolations
using StaticArrays
using DiscreteValueIteration
using AutomotiveDrivingModels
using AutoUrban
using AutoViz
using AutomotiveSensors
using Reel
using Random
using DataStructures
using LinearAlgebra
import Cairo
"""
Abstract type to define driving environment with occlusion
"""
abstract type OccludedEnv end
# helpers
export
# for rendering
animate_hist,
animate_record,
animate_scenes,
# helpers
get_end,
get_lanes,
get_start_lanes,
get_exit_lanes,
get_ego,
is_crash,
direction_from_center,
random_route,
is_observable_dyna,
is_observable_fixed,
off_the_grid,
get_conflict_lanes,
get_colors,
next_car_id,
next_ped_id,
EGO_ID,
CAR_ID,
PED_ID,
EgoDriver
include("constants.jl")
include("utils/helpers.jl")
include("utils/occlusions.jl")
include("utils/rendering.jl")
# envs
export
OccludedEnv,
CrosswalkParams,
CrosswalkEnv,
TInterParams,
IntersectionEnv,
SimpleInterParams,
SimpleInterEnv,
gen_T_roadway,
UrbanParams,
UrbanEnv,
ObstacleDistribution,
sample_obstacles!,
sample_obstacle!,
empty_obstacles!,
add_obstacle!,
car_roadway
include("envs/occluded_crosswalk_env.jl")
include("envs/multi_lane_T_env.jl")
include("envs/urban_env.jl")
include("envs/obstacles.jl")
include("envs/rendering.jl")
# driver models and action types
export
action_space,
get_distribution,
ConstantPedestrian,
ConstantSpeedDawdling,
RouteFollowingIDM,
set_direction!,
get_direction,
LonAccelDirection,
CrosswalkDriver,
StopIntersectionDriver,
TTCIntersectionDriver,
UrbanDriver,
IntelligentPedestrian,
LidarOverlay,
get_stop_model,
get_ttc_model
include("driver_models/route_following_idm.jl")
include("driver_models/stop.jl")
include("driver_models/stop_intersection_driver.jl")
include("driver_models/ttc_intersection_driver.jl")
include("driver_models/constant_pedestrian.jl")
include("driver_models/crosswalk_driver.jl")
include("driver_models/urban_driver.jl")
include("driver_models/lidar_sensor.jl")
include("driver_models/intelligent_pedestrian_model.jl")
include("driver_models/helpers.jl")
export
# pomdp types
OCPOMDP,
OCAction,
OCState,
OCObs,
SingleOCPOMDP,
SingleOCAction,
SingleOCState,
SingleOCObs,
SingleOCBelief,
SingleOCDistribution,
SingleOCUpdater,
OIPOMDP,
OIAction,
OIState,
OIObs,
SingleOIPOMDP,
SingleOIAction,
SingleOIState,
SingleOIObs,
state_to_scene,
UrbanPOMDP,
UrbanState,
UrbanAction,
UrbanObs,
initial_car,
initial_pedestrian,
initial_ego,
obs_weight,
rescale!,
unrescale!,
obs_to_scene,
fuse_value,
fuse_value_min,
interpolate_state,
scene_to_states,
states_to_scene,
normalized_off_the_grid_pos,
get_normalized_absent_state,
split_o,
n_dims
# single crosswalk
include("explicit_pomdps/single_crosswalk/pomdp_types.jl")
include("explicit_pomdps/single_crosswalk/spaces.jl")
include("explicit_pomdps/single_crosswalk/transition.jl")
include("explicit_pomdps/single_crosswalk/observation.jl")
include("explicit_pomdps/single_crosswalk/belief.jl")
include("explicit_pomdps/single_crosswalk/adm_helpers.jl")
include("explicit_pomdps/single_crosswalk/render_helpers.jl")
include("explicit_pomdps/single_crosswalk/decomposition.jl")
# multi crowsswalk
include("generative_pomdps/multi_crosswalk/pomdp_types.jl")
include("generative_pomdps/multi_crosswalk/generative_model.jl")
include("generative_pomdps/multi_crosswalk/render_helpers.jl")
# single intersection
include("explicit_pomdps/single_intersection/occluded_intersection_env.jl")
include("explicit_pomdps/single_intersection/pomdp_types.jl")
include("explicit_pomdps/single_intersection/spaces.jl")
include("explicit_pomdps/single_intersection/transition.jl")
include("explicit_pomdps/single_intersection/observation.jl")
include("explicit_pomdps/single_intersection/belief.jl")
include("explicit_pomdps/single_intersection/render_helpers.jl")
# multi intersection
include("generative_pomdps/multi_lane_T_intersection/pomdp_types.jl")
include("generative_pomdps/multi_lane_T_intersection/generative_model.jl")
include("generative_pomdps/multi_lane_T_intersection/render_helpers.jl")
#urban
include("generative_pomdps/urban/pomdp_types.jl")
include("generative_pomdps/urban/generative_model.jl")
include("generative_pomdps/urban/render_helpers.jl")
export
CarMDP,
CarMDPState,
CarMDPAction,
PedMDP,
PedMDPState,
PedMDPAction
export
labeling,
get_mdp_state,
state2scene,
get_car_vspace,
get_ped_vspace,
get_ego_states,
get_car_states,
get_ped_states,
get_car_routes,
get_ped_lanes,
ind2ego,
ind2ped,
ind2car,
find_route,
ego_stateindex,
ped_stateindex,
car_stateindex,
n_ego_states,
n_car_states,
n_ped_states,
get_off_the_grid,
get_ped_mdp,
get_car_mdp,
get_car_models,
get_stop_model,
get_ttc_model,
get_discretized_lane,
interpolate_pedestrian,
interpolate_state
# more discrete POMDPs
include("explicit_pomdps/discretization.jl")
include("explicit_pomdps/rendering.jl")
include("explicit_pomdps/car_mdp/pomdp_types.jl")
include("explicit_pomdps/car_mdp/state_space.jl")
include("explicit_pomdps/car_mdp/transition.jl")
include("explicit_pomdps/car_mdp/render_helpers.jl")
include("explicit_pomdps/car_mdp/high_fidelity.jl")
include("explicit_pomdps/pedestrian_mdp/pomdp_types.jl")
include("explicit_pomdps/pedestrian_mdp/state_space.jl")
include("explicit_pomdps/pedestrian_mdp/transition.jl")
include("explicit_pomdps/pedestrian_mdp/render_helpers.jl")
include("explicit_pomdps/pedestrian_mdp/high_fidelity.jl")
# include("explicit_pomdps/pedcar_mdp/driver_models_helpers.jl")
# include("explicit_pomdps/pedcar_mdp/pomdp_types.jl")
# include("explicit_pomdps/pedcar_mdp/state_space.jl")
# include("explicit_pomdps/pedcar_mdp/transition.jl")
# include("explicit_pomdps/pedcar_mdp/high_fidelity.jl")
# include("explicit_pomdps/pedcar_mdp/render_helpers.jl")
include("explicit_pomdps/interpolation.jl")
export
# decomposition stuff
TwoCars,
ObsPed,
ObsCar,
TwoCarsScenario,
PedCarScenario,
ObsPedScenario,
ObsCarScenario,
decompose_input,
DecomposedPolicy,
KMarkovDecUpdater,
KMarkovDecBelief,
PreviousObsDecUpdater,
PreviousObsDecBelief,
initialize_dec_belief,
BeliefOverlay
include("decomposition/base_scenarios.jl")
include("decomposition/decomposition_wrapper.jl")
include("decomposition/rendering.jl")
end
|
From Hammer Require Import Hammer.
Require Import PeanoNat Even NAxioms.
Module Nat <: NAxiomsSig := Nat.
Notation leb := Nat.leb (compat "8.4").
Notation ltb := Nat.ltb (compat "8.4").
Notation leb_le := Nat.leb_le (compat "8.4").
Notation ltb_lt := Nat.ltb_lt (compat "8.4").
Notation pow := Nat.pow (compat "8.4").
Notation pow_0_r := Nat.pow_0_r (compat "8.4").
Notation pow_succ_r := Nat.pow_succ_r (compat "8.4").
Notation square := Nat.square (compat "8.4").
Notation square_spec := Nat.square_spec (compat "8.4").
Notation Even := Nat.Even (compat "8.4").
Notation Odd := Nat.Odd (compat "8.4").
Notation even := Nat.even (compat "8.4").
Notation odd := Nat.odd (compat "8.4").
Notation even_spec := Nat.even_spec (compat "8.4").
Notation odd_spec := Nat.odd_spec (compat "8.4").
Lemma Even_equiv n : Even n <-> Even.even n.
Proof. hammer_hook "NPeano" "NPeano.Even_equiv". symmetry. apply Even.even_equiv. Qed.
Lemma Odd_equiv n : Odd n <-> Even.odd n.
Proof. hammer_hook "NPeano" "NPeano.Odd_equiv". symmetry. apply Even.odd_equiv. Qed.
Notation divmod := Nat.divmod (compat "8.4").
Notation div := Nat.div (compat "8.4").
Notation modulo := Nat.modulo (compat "8.4").
Notation divmod_spec := Nat.divmod_spec (compat "8.4").
Notation div_mod := Nat.div_mod (compat "8.4").
Notation mod_bound_pos := Nat.mod_bound_pos (compat "8.4").
Notation sqrt_iter := Nat.sqrt_iter (compat "8.4").
Notation sqrt := Nat.sqrt (compat "8.4").
Notation sqrt_iter_spec := Nat.sqrt_iter_spec (compat "8.4").
Notation sqrt_spec := Nat.sqrt_spec (compat "8.4").
Notation log2_iter := Nat.log2_iter (compat "8.4").
Notation log2 := Nat.log2 (compat "8.4").
Notation log2_iter_spec := Nat.log2_iter_spec (compat "8.4").
Notation log2_spec := Nat.log2_spec (compat "8.4").
Notation log2_nonpos := Nat.log2_nonpos (compat "8.4").
Notation gcd := Nat.gcd (compat "8.4").
Notation divide := Nat.divide (compat "8.4").
Notation gcd_divide := Nat.gcd_divide (compat "8.4").
Notation gcd_divide_l := Nat.gcd_divide_l (compat "8.4").
Notation gcd_divide_r := Nat.gcd_divide_r (compat "8.4").
Notation gcd_greatest := Nat.gcd_greatest (compat "8.4").
Notation testbit := Nat.testbit (compat "8.4").
Notation shiftl := Nat.shiftl (compat "8.4").
Notation shiftr := Nat.shiftr (compat "8.4").
Notation bitwise := Nat.bitwise (compat "8.4").
Notation land := Nat.land (compat "8.4").
Notation lor := Nat.lor (compat "8.4").
Notation ldiff := Nat.ldiff (compat "8.4").
Notation lxor := Nat.lxor (compat "8.4").
Notation double_twice := Nat.double_twice (compat "8.4").
Notation testbit_0_l := Nat.testbit_0_l (compat "8.4").
Notation testbit_odd_0 := Nat.testbit_odd_0 (compat "8.4").
Notation testbit_even_0 := Nat.testbit_even_0 (compat "8.4").
Notation testbit_odd_succ := Nat.testbit_odd_succ (compat "8.4").
Notation testbit_even_succ := Nat.testbit_even_succ (compat "8.4").
Notation shiftr_spec := Nat.shiftr_spec (compat "8.4").
Notation shiftl_spec_high := Nat.shiftl_spec_high (compat "8.4").
Notation shiftl_spec_low := Nat.shiftl_spec_low (compat "8.4").
Notation div2_bitwise := Nat.div2_bitwise (compat "8.4").
Notation odd_bitwise := Nat.odd_bitwise (compat "8.4").
Notation div2_decr := Nat.div2_decr (compat "8.4").
Notation testbit_bitwise_1 := Nat.testbit_bitwise_1 (compat "8.4").
Notation testbit_bitwise_2 := Nat.testbit_bitwise_2 (compat "8.4").
Notation land_spec := Nat.land_spec (compat "8.4").
Notation ldiff_spec := Nat.ldiff_spec (compat "8.4").
Notation lor_spec := Nat.lor_spec (compat "8.4").
Notation lxor_spec := Nat.lxor_spec (compat "8.4").
Infix "<=?" := Nat.leb (at level 70) : nat_scope.
Infix "<?" := Nat.ltb (at level 70) : nat_scope.
Infix "^" := Nat.pow : nat_scope.
Infix "/" := Nat.div : nat_scope.
Infix "mod" := Nat.modulo (at level 40, no associativity) : nat_scope.
Notation "( x | y )" := (Nat.divide x y) (at level 0) : nat_scope.
|
#! /home/ubuntu/anaconda2/envs/rllabpp/bin/python
from http.server import BaseHTTPRequestHandler, HTTPServer
import json
import argparse
import urllib.parse as urlparse
# from osim.env import RunEnv
import numpy as np
from runenv.helpers import Scaler
import multiprocessing
import pickle, os, joblib
import random, redis
import tensorflow as tf
from rllab.sampler.utils import rollout
from rllab.envs.gym_env import GymEnv
from rllab.envs.normalized_env import normalize
from sandbox.rocky.tf.envs.base import TfEnv
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
PORT_NUMBER = 8018
def dump_episodes(env_name, difficulty,
chk_dir, batch_size, cores,
max_obstacles, filter_type, history_len):
scaler_file = os.path.join(chk_dir, 'scaler_latest')
if os.path.exists(scaler_file):
scaler = pickle.load(open(scaler_file, 'rb'))
else:
scaler = None
redis_conn = redis.Redis()
redis_key = 'curr_batch_size-' + chk_dir
redis_conn.set(redis_key, 0)
p = multiprocessing.Pool(cores, maxtasksperchild=1)
paths = p.map(get_paths_from_latest_policy,
[(env_name, difficulty, max_obstacles, filter_type, history_len,
chk_dir, scaler, batch_size//cores, batch_size)]*cores)
p.close()
p.join()
paths = sum(paths, [])
redis_conn.set(redis_key, 0)
episodes_file = os.path.join(chk_dir, 'episodes_latest')
pickle.dump(paths, open(episodes_file, 'wb'))
def get_paths_from_latest_policy(pickled_obj):
"""
pickled_obj = (env_name, difficulty, max_obstacles, filter_type, history_len,
chk_dir, scaler, batch_size_per_cores, batch_size)
"""
env_name = pickled_obj[0]
difficulty = pickled_obj[1]
max_obstacles = pickled_obj[2]
filter_type = pickled_obj[3]
history_len = pickled_obj[4]
chk_dir = pickled_obj[5]
scaler = pickled_obj[6]
batch_size_per_core = pickled_obj[7]
batch_size = pickled_obj[8]
redis_conn = redis.Redis()
redis_key = 'curr_batch_size-' + chk_dir
with tf.Session() as sess:
data = joblib.load(os.path.join(chk_dir, 'params.pkl'))
policy = data['policy']
print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@")
print("creating env on server")
env = TfEnv(GymEnv(env_name, difficulty=difficulty,
runenv_seed=1, visualize=False,
record_log=False, record_video=False, filter_type=filter_type,
history_len=history_len, max_obstacles=max_obstacles))
print(env.wrapped_env.monitoring, "monitoring state")
total_length = 0
paths = []
# while total_length < batch_size_per_core:
while True:
path = rollout(env, policy, max_path_length=1000,
animated=False, always_return_paths=True, scaler=scaler,
redis_conn=redis_conn, redis_key=redis_key, batch_size=batch_size)
paths.append(path)
redis_conn.incrby(redis_key, len(path['rewards']))
b_size = int(redis_conn.get(redis_key))
total_length += len(path['rewards'])
if b_size >= batch_size:
break
return paths
class myHandler(BaseHTTPRequestHandler):
def do_GET(self):
if '/ping' in self.path:
print(self.path)
parsed_url = urlparse.urlparse(self.path)
print(urlparse.parse_qs(parsed_url.query))
print('lmao it worked')
self.send_response(200)
self.send_header('Content-type', 'application/javascript')
self.end_headers()
self.wfile.write(bytes(json.dumps({'anil': 'tanu'}), 'utf8'))
return
elif '/get_paths' in self.path:
print(self.path)
parsed_url = urlparse.urlparse(self.path)
query = urlparse.parse_qs(parsed_url.query)
env_name = query['env_name'][0]
chk_dir = query['chk_dir'][0]
batch_size = int(query['batch_size'][0])
cores = int(query['cores'][0])
difficulty = int(query['difficulty'][0])
max_obstacles = int(query['max_obstacles'][0])
if 'filter_type' in query:
filter_type = str(query['filter_type'][0])
else:
filter_type = ''
history_len = int(query['history_len'][0])
dump_episodes(env_name, difficulty, chk_dir, batch_size, cores,
max_obstacles, filter_type, history_len)
self.send_response(200)
self.send_header('Content-type', 'application/javascript')
self.end_headers()
self.wfile.write(bytes(json.dumps({'Success': 'OK'}), 'utf8'))
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--listen', type=str, default='127.0.0.1')
parser.add_argument('--port', type=int, default=PORT_NUMBER)
args = parser.parse_args()
server = HTTPServer((args.listen, args.port), myHandler)
print('Server started on', args)
server.serve_forever()
|
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*
*************************************************************/
#ifndef SD_FU_FORMATPAINTBRUSH_HXX
#define SD_FU_FORMATPAINTBRUSH_HXX
#include "futext.hxx"
// header for class SfxItemSet
#include <svl/itemset.hxx>
#include <boost/scoped_ptr.hpp>
namespace sd {
class DrawViewShell;
class FuFormatPaintBrush : public FuText
{
public:
TYPEINFO();
static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
virtual sal_Bool MouseMove(const MouseEvent& rMEvt);
virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt);
virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt);
virtual sal_Bool KeyInput(const KeyEvent& rKEvt);
virtual void Activate();
virtual void Deactivate();
static void GetMenuState( DrawViewShell& rDrawViewShell, SfxItemSet &rSet );
static bool CanCopyThisType( sal_uInt32 nObjectInventor, sal_uInt16 nObjectIdentifier );
private:
FuFormatPaintBrush ( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq);
void DoExecute( SfxRequest& rReq );
bool HasContentForThisType( sal_uInt32 nObjectInventor, sal_uInt16 nObjectIdentifier ) const;
void Paste( bool, bool );
void implcancel();
::boost::shared_ptr<SfxItemSet> mpItemSet;
bool mbPermanent;
bool mbOldIsQuickTextEditMode;
};
} // end of namespace sd
#endif
|
# Script 1
Based on https://www.geekstips.com/battery-life-calculator-sleep-mode/.
This version does a more liberal calculation.
[Github Backup](https://github.com/jmBSU/maskMisc/blob/main/batterylife.ipynb)
---
## Motivation
This was originally on Matlab but to change values and see the results would require you to download it and run it. It was not worth the extra hassle. Thus, it is here instead.
---
## Warning Popup
Just click "run anyway". For some odd reason when I was copying from my test environment, it thought that it was malicious.
---
## Current Values
If this works, this should plot the battery life assuming the following:
* Battery: 2 AAA in Series for 3.0 to 3.2V nominal
* Rated for 1200 mAh total
* Sleep cycle consumes 18mA
* Wake cycle consumes 30mA
* 2 minute uptime followed by 8 minute sleep
* Calculation includes a derate of 15% on the battery
```python
%matplotlib inline
import matplotlib.pyplot as plt
from matplotlib.pyplot import figure
import numpy as np
import sympy as sym
#Batter Capacity in mAh
batteryCap = 1200;
#Power draw in mA
wakePower = 30;
sleepPower = 18;
#wake and sleep time in Minutes
wakeTime = 2;
sleepTime = 8;
#For loop for 0 to 70 hours
x = [];
for i in range(71*60):
x.append(i/60)
#Calculates y for each x manually
yarray = [];
timeCounter = 0;
timeMax = wakeTime + sleepTime;
y = batteryCap * 0.85 * 60;
yarray.append(y/60);
for i in range(71*60):
#ignores 1st data entry
if i != 0:
#y must be positive - makes all <0 to =0
if y > 0:
#Clears internal count
if timeCounter == timeMax:
timeCounter = 0;
#Assumes sleep first - starts decrementing per minute
if timeCounter < sleepTime:
y -= sleepPower;
yarray.append(y/60);
#This is for when it is awake - aka the remainder of timeMax
elif timeCounter < timeMax:
y -= wakePower;
yarray.append(y/60);
timeCounter+=1;
else:
yarray.append(0)
#Makes image big and good lookin - 4x3 at 300dpi
figure(figsize=(4,3), dpi=300)
#Plots a linear function of battery
plt.plot(x,yarray);
plt.xlabel("Time (hrs)");
plt.ylabel("mAh");
plt.title("Battery Life");
plt.grid();
#Finds the first 0, the index indicates the minute it is dead
hourDead = yarray.index(0)/60;
dayDead = hourDead/24;
print("Hours till battery is dead:","%0.2f" % hourDead,"or", "%0.2f" % dayDead, "days");
```
# Script 2 (Old)
This bottom script was the initial version where it plots the battery life via a linear equation. The main issue with this code was that it was scaled by the hour. This meant that uptime and sleeptime must add up and be repeatable to the hour.
i.e:
* 2 min up + 8 min sleep = 10 min total
* 10 min * 6 runs in an hour = 60 minutes
Thus 12 min up in a hour, and 48 min sleep in an hour.
This converts to 0.2 uptime in an hour and 0.8 sleep in an hour.
These decimals are fed into the code and plotted.
```python
%matplotlib inline
import matplotlib.pyplot as plt
from matplotlib.pyplot import figure
import numpy as np
import sympy as sym
#Batter Capacity in mAh
batteryCap = 1200;
#Power draw in mA
wakePower = 30;
sleepPower = 18;
#Fraction on a per hour basis
wakeTime = 0.2;
sleepTime = 0.8;
x = [];
#For loop for 0 to 70 hours
for i in range(71):
x.append(i)
#Makes image big and good lookin - 4x3 at 300dpi
figure(figsize=(4,3), dpi=300)
#Plots a linear function of battery life
x = np.asarray(x);
plt.plot(x,batteryCap*0.85- sleepPower*sleepTime*x-wakePower*wakeTime*x);
plt.xlabel("Time (hr)");
plt.ylabel("mAh");
plt.title("Battery Life");
plt.grid();
plt.axis([0,70,0,1200]);
#Solves the hour and day battery is dead.
sym.var('hour');
eqn = sym.Eq(0,batteryCap*0.85- sleepPower*sleepTime*hour-wakePower*wakeTime*hour);
hourDead = sym.solve(eqn,hour);
dayDead = hourDead[0] / 24;
print("Hours till battery is dead:","%0.2f" % hourDead[0],"or", "%0.2f" % dayDead, "days");
```
|
Formal statement is: lemma filterlim_at_top_mirror: "(LIM x at_top. f x :> F) \<longleftrightarrow> (LIM x at_bot. f (-x::real) :> F)" Informal statement is: The filter $\{f(x) \mid x \geq a\}$ is the same as the filter $\{f(-x) \mid x \leq -a\}$.
|
[STATEMENT]
lemma scalar_prod_ntt:
"scalar_product v w = scalar_prod_ntt v w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. scalar_product v w = v \<bullet>\<^bsub>ntt\<^esub> w
[PROOF STEP]
unfolding scalar_product_def scalar_prod_ntt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<Sum>i\<in>UNIV. v $ i * w $ i) = (\<Sum>i\<in>UNIV. v $ i *\<^bsub>ntt\<^esub> w $ i)
[PROOF STEP]
using mult_ntt
[PROOF STATE]
proof (prove)
using this:
?f * ?g = ?f *\<^bsub>ntt\<^esub> ?g
goal (1 subgoal):
1. (\<Sum>i\<in>UNIV. v $ i * w $ i) = (\<Sum>i\<in>UNIV. v $ i *\<^bsub>ntt\<^esub> w $ i)
[PROOF STEP]
by auto
|
# License
https://raw.githubusercontent.com/computational-sediment-hyd/tridiagonal-algorithm-matrix-of-periodic-boundary-conditions/master/LICENSE
# tridiagonal algorithm matrix of periodic boundary conditions
## はじめに
- 周期境界の三重対角は代表的な問題.
- その解法は,Sherman-Morrison formulaを使う.
- 参考(一部間違いあり)
:https://www.cfd-online.com/Wiki/Tridiagonal_matrix_algorithm_-_TDMA_%28Thomas_algorithm%29
## Sherman-Morrison formulaとは
参考:https://mathtrain.jp/woodbury
- 逆行列の補助定理(Woodburyの恒等式)の特別な場合を示す.
逆行列の補助定理とは下式である.
$$
(A+BDC)^{-1}=A^{-1}-A^{-1}B(D^{-1}+CA^{-1}B)^{-1}CA^{-1}
$$
証明は省略する.
$
A:n\times n \,,\,
B:n\times k \,,\,
C:k\times n \,,\,
D:k\times k
$
が条件.
$k=1\,,\, D=1$のときは,
$$
(A+BC)^{-1}=A^{-1}-A^{-1}B(1+CA^{-1}B)^{-1}CA^{-1}
$$
であり,本式がシャーマンモリソンの公式と呼ばれる.
この式の良いところは,$A$の逆行列が計算できると$A+BC$の逆行列が計算できる点です.
今回の問題を例にとると,$A$にTDMAができれば,$A+BC$の逆行列が簡単に計算できるということ.
## 周期境界三重対角への適用
実際に計算してみます.
$$
A'x=d
$$
$$
A' =
\left(
\begin{array}{cccc}
b_1 & c_1 & 0 & a_1 \\
a_2 & b_2 & c_2 & 0 \\
0 & a_3 & b_3 & c_3 \\
c_4 & 0 & a_4 & b_4 \\
\end{array}
\right)
$$
とすると,
$$
A' = A + B \times C
$$
$$
A =
\left(
\begin{array}{cccc}
2 b_1 & c_1 & 0 & 0 \\
a_2 & b_2 & c_2 & 0 \\
0 & a_3 & b_3 & c_3 \\
0 & 0 & a_4 & b_4 + \dfrac{a_1 c_4}{b_1} \\
\end{array}
\right)
$$
$$
B =
\left(
\begin{array}{c}
-b_1 \\
0 \\
0 \\
c_4 \\
\end{array}
\right)
$$
$$
C =
\left(
\begin{array}{cccc}
1 & 0 & 0 & -\dfrac{a_1}{b_1}
\end{array}
\right)
$$
となるので,$A$にTDMAが適用できます
あとは,公式にあてはめて展開する.
$$
A y = d \,,\, A z = B \\
y = A^{-1} d \,,\, z = A^{-1} B
$$
とおくと
$$
x = y - \dfrac{C \cdot y}{1 + C \cdot z}z
$$
となり,右辺第二項は$z$のスカラー倍のため,2回のTDMAで容易に計算可能である.
## 補足:TDMA(導出は省略)
- 一般的にはメモリ節約版を使いますが(パタンカーの影響?),分かりにくいので通常版を使います.
三重対角行列
$$
a_i x_{i-1} + b_i x_i + c_i x_{i+1} = d_i
$$
について,
$$
\begin{align}
P_i &= -\frac{c_i}{a_i P_{i-1} + b_i} \\
Q_i &= \frac{-a_iQ_{i-1}+d_i}{a_i P_{i-1} + b_i} \\
P_1 &= -\frac{c_1}{b_1} \\
Q_1 &= \frac{d_1}{b_1}
\end{align}
$$
とすると,
$$
\begin{align}
x_n &= Q_n \\
x_i &= P_ix_{i+1} + Q_i
\end{align}
$$
## 実装
### Periodic boundary TDMA source code
```python
import numpy as np
def pTDMA(a,b,c,d):
def TDMA(a,b,c,d):
x, P, Q = np.empty_like(a), np.empty_like(a), np.empty_like(a)
n = len(x)
P[0], Q[0] = -c[0]/b[0], d[0]/b[0]
for i in range(1, n):
P[i] = - c[i] /(a[i]*P[i-1] + b[i])
Q[i] = (-a[i]*Q[i-1] + d[i])/(a[i]*P[i-1] + b[i])
x[-1] = Q[-1]
for i in range(n-2, -1, -1):
x[i] = P[i]*x[i+1] + Q[i]
return x
a, b, c, d = np.array(a,dtype=float), np.array(b,dtype=float), np.array(c,dtype=float), np.array(d,dtype=float)
a1, b1, c1, d1 = np.copy(a), np.copy(b), np.copy(c), np.copy(d) #deep copy
a1[0], c1[-1] = 0.0, 0.0
b1[0] = 2.0*b[0]
b1[-1] = b[-1] + a[0]*c[-1]/b[0]
d1[:] = 0.0
d1[0] = -b[0]
d1[-1] = c[-1]
y = TDMA(a1,b1,c1,d)
z = TDMA(a1,b1,c1,d1)
w = ( y[0] - a[0]/b[0]*y[-1] ) / ( 1 + (z[0]- a[0]/b[0]*z[-1]) )
x = y - w * z
return x
```
### test
```python
n = 10
a = np.ones(n)
b = np.ones(n)
c = np.ones(n)
d = np.arange(1,n+1,1,dtype=float)
a *= -0.2
c *= 0.2
x = pTDMA(a,b,c,d)
print(x)
```
[ 2.81456954 2.02649007 2.68211921 3.61589404 4.60264901 5.60264901
6.58940397 7.65562914 8.31125828 11.09933775]
- check print d
```python
print( b[0]*x[0] + c[0]*x[1] + a[0]*x[-1] )
for i in range(1, n-1):
print( a[i]*x[i-1] + b[i]*x[i] + c[i]*x[i+1] )
print( a[-1]*x[-2] + b[-1]*x[-1] + c[-1]*x[0] )
```
1.0000000000000004
2.0
3.0
3.9999999999999996
5.0
6.0
7.0
8.0
9.0
9.999999999999998
|
The absolute value function $|\cdot|$ is a limit of the real numbers.
|
using HorizonSideRobots
mutable struct Coord
x::Int
y::Int
Coord() = new(0,0)
Coord(x::Int,y::Int) = new(x,y)
end
function move!(coord::Coord, side::HorizonSide)
if side==Nord
coord.y += 1
elseif side==Sud
coord.y -= 1
elseif side==Ost
coord.x += 1
else
coord.x -= 1
end
end
get_coords(coord::Coord) = (coord.x, coord.y)
|
lemma space_Sup_measure'2: "space (Sup_measure' M) = (\<Union>m\<in>M. space m)"
|
/-
Copyright (c) 2014 Parikshit Khanna. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Parikshit Khanna, Jeremy Avigad, Leonardo de Moura, Floris van Doorn, Mario Carneiro
-/
import Mathlib.PrePort
import Mathlib.Lean3Lib.init.default
import Mathlib.data.option.defs
import Mathlib.logic.basic
import Mathlib.tactic.cache
import Mathlib.PostPort
universes u_1 u v w u_2
namespace Mathlib
/-!
## Definitions on lists
This file contains various definitions on lists. It does not contain
proofs about these definitions, those are contained in other files in `data/list`
-/
namespace list
/-- Returns whether a list is []. Returns a boolean even if `l = []` is not decidable. -/
def is_nil {α : Type u_1} : List α → Bool :=
sorry
protected instance has_sdiff {α : Type u} [DecidableEq α] : has_sdiff (List α) :=
has_sdiff.mk list.diff
/-- Split a list at an index.
split_at 2 [a, b, c] = ([a, b], [c]) -/
def split_at {α : Type u} : ℕ → List α → List α × List α :=
sorry
/-- An auxiliary function for `split_on_p`. -/
def split_on_p_aux {α : Type u} (P : α → Prop) [decidable_pred P] : List α → (List α → List α) → List (List α) :=
sorry
/-- Split a list at every element satisfying a predicate. -/
def split_on_p {α : Type u} (P : α → Prop) [decidable_pred P] (l : List α) : List (List α) :=
split_on_p_aux P l id
/-- Split a list at every occurrence of an element.
[1,1,2,3,2,4,4].split_on 2 = [[1,1],[3],[4,4]] -/
def split_on {α : Type u} [DecidableEq α] (a : α) (as : List α) : List (List α) :=
split_on_p (fun (_x : α) => _x = a) as
/-- Concatenate an element at the end of a list.
concat [a, b] c = [a, b, c] -/
@[simp] def concat {α : Type u} : List α → α → List α :=
sorry
/-- `head' xs` returns the first element of `xs` if `xs` is non-empty;
it returns `none` otherwise -/
@[simp] def head' {α : Type u} : List α → Option α :=
sorry
/-- Convert a list into an array (whose length is the length of `l`). -/
def to_array {α : Type u} (l : List α) : array (length l) α :=
d_array.mk fun (v : fin (length l)) => nth_le l (subtype.val v) sorry
/-- "inhabited" `nth` function: returns `default` instead of `none` in the case
that the index is out of bounds. -/
@[simp] def inth {α : Type u} [h : Inhabited α] (l : List α) (n : ℕ) : α :=
option.iget (nth l n)
/-- Apply a function to the nth tail of `l`. Returns the input without
using `f` if the index is larger than the length of the list.
modify_nth_tail f 2 [a, b, c] = [a, b] ++ f [c] -/
@[simp] def modify_nth_tail {α : Type u} (f : List α → List α) : ℕ → List α → List α :=
sorry
/-- Apply `f` to the head of the list, if it exists. -/
@[simp] def modify_head {α : Type u} (f : α → α) : List α → List α :=
sorry
/-- Apply `f` to the nth element of the list, if it exists. -/
def modify_nth {α : Type u} (f : α → α) : ℕ → List α → List α :=
modify_nth_tail (modify_head f)
/-- Apply `f` to the last element of `l`, if it exists. -/
@[simp] def modify_last {α : Type u} (f : α → α) : List α → List α :=
sorry
/-- `insert_nth n a l` inserts `a` into the list `l` after the first `n` elements of `l`
`insert_nth 2 1 [1, 2, 3, 4] = [1, 2, 1, 3, 4]`-/
def insert_nth {α : Type u} (n : ℕ) (a : α) : List α → List α :=
modify_nth_tail (List.cons a) n
/-- Take `n` elements from a list `l`. If `l` has less than `n` elements, append `n - length l`
elements `default α`. -/
def take' {α : Type u} [Inhabited α] (n : ℕ) : List α → List α :=
sorry
/-- Get the longest initial segment of the list whose members all satisfy `p`.
take_while (λ x, x < 3) [0, 2, 5, 1] = [0, 2] -/
def take_while {α : Type u} (p : α → Prop) [decidable_pred p] : List α → List α :=
sorry
/-- Fold a function `f` over the list from the left, returning the list
of partial results.
scanl (+) 0 [1, 2, 3] = [0, 1, 3, 6] -/
def scanl {α : Type u} {β : Type v} (f : α → β → α) : α → List β → List α :=
sorry
/-- Auxiliary definition used to define `scanr`. If `scanr_aux f b l = (b', l')`
then `scanr f b l = b' :: l'` -/
def scanr_aux {α : Type u} {β : Type v} (f : α → β → β) (b : β) : List α → β × List β :=
sorry
/-- Fold a function `f` over the list from the right, returning the list
of partial results.
scanr (+) 0 [1, 2, 3] = [6, 5, 3, 0] -/
def scanr {α : Type u} {β : Type v} (f : α → β → β) (b : β) (l : List α) : List β :=
sorry
/-- Product of a list.
prod [a, b, c] = ((1 * a) * b) * c -/
def prod {α : Type u} [Mul α] [HasOne α] : List α → α :=
foldl Mul.mul 1
/-- Sum of a list.
sum [a, b, c] = ((0 + a) + b) + c -/
-- Later this will be tagged with `to_additive`, but this can't be done yet because of import
-- dependencies.
def sum {α : Type u} [Add α] [HasZero α] : List α → α :=
foldl Add.add 0
/-- The alternating sum of a list. -/
def alternating_sum {G : Type u_1} [HasZero G] [Add G] [Neg G] : List G → G :=
sorry
/-- The alternating product of a list. -/
def alternating_prod {G : Type u_1} [HasOne G] [Mul G] [has_inv G] : List G → G :=
sorry
/-- Given a function `f : α → β ⊕ γ`, `partition_map f l` maps the list by `f`
whilst partitioning the result it into a pair of lists, `list β × list γ`,
partitioning the `sum.inl _` into the left list, and the `sum.inr _` into the right list.
`partition_map (id : ℕ ⊕ ℕ → ℕ ⊕ ℕ) [inl 0, inr 1, inl 2] = ([0,2], [1])` -/
def partition_map {α : Type u} {β : Type v} {γ : Type w} (f : α → β ⊕ γ) : List α → List β × List γ :=
sorry
/-- `find p l` is the first element of `l` satisfying `p`, or `none` if no such
element exists. -/
def find {α : Type u} (p : α → Prop) [decidable_pred p] : List α → Option α :=
sorry
/-- `mfind tac l` returns the first element of `l` on which `tac` succeeds, and
fails otherwise. -/
def mfind {α : Type u} {m : Type u → Type v} [Monad m] [alternative m] (tac : α → m PUnit) : List α → m α :=
mfirst fun (a : α) => tac a $> a
/-- `mbfind' p l` returns the first element `a` of `l` for which `p a` returns
true. `mbfind'` short-circuits, so `p` is not necessarily run on every `a` in
`l`. This is a monadic version of `list.find`. -/
def mbfind' {m : Type u → Type v} [Monad m] {α : Type u} (p : α → m (ulift Bool)) : List α → m (Option α) :=
sorry
/-- A variant of `mbfind'` with more restrictive universe levels. -/
def mbfind {m : Type → Type v} [Monad m] {α : Type} (p : α → m Bool) (xs : List α) : m (Option α) :=
mbfind' (Functor.map ulift.up ∘ p) xs
/-- `many p as` returns true iff `p` returns true for any element of `l`.
`many` short-circuits, so if `p` returns true for any element of `l`, later
elements are not checked. This is a monadic version of `list.any`. -/
-- Implementing this via `mbfind` would give us less universe polymorphism.
def many {m : Type → Type v} [Monad m] {α : Type u} (p : α → m Bool) : List α → m Bool :=
sorry
/-- `mall p as` returns true iff `p` returns true for all elements of `l`.
`mall` short-circuits, so if `p` returns false for any element of `l`, later
elements are not checked. This is a monadic version of `list.all`. -/
def mall {m : Type → Type v} [Monad m] {α : Type u} (p : α → m Bool) (as : List α) : m Bool :=
bnot <$> many (fun (a : α) => bnot <$> p a) as
/-- `mbor xs` runs the actions in `xs`, returning true if any of them returns
true. `mbor` short-circuits, so if an action returns true, later actions are
not run. This is a monadic version of `list.bor`. -/
def mbor {m : Type → Type v} [Monad m] : List (m Bool) → m Bool :=
many id
/-- `mband xs` runs the actions in `xs`, returning true if all of them return
true. `mband` short-circuits, so if an action returns false, later actions are
not run. This is a monadic version of `list.band`. -/
def mband {m : Type → Type v} [Monad m] : List (m Bool) → m Bool :=
mall id
/-- Auxiliary definition for `foldl_with_index`. -/
def foldl_with_index_aux {α : Type u} {β : Type v} (f : ℕ → α → β → α) : ℕ → α → List β → α :=
sorry
/-- Fold a list from left to right as with `foldl`, but the combining function
also receives each element's index. -/
def foldl_with_index {α : Type u} {β : Type v} (f : ℕ → α → β → α) (a : α) (l : List β) : α :=
foldl_with_index_aux f 0 a l
/-- Auxiliary definition for `foldr_with_index`. -/
def foldr_with_index_aux {α : Type u} {β : Type v} (f : ℕ → α → β → β) : ℕ → β → List α → β :=
sorry
/-- Fold a list from right to left as with `foldr`, but the combining function
also receives each element's index. -/
def foldr_with_index {α : Type u} {β : Type v} (f : ℕ → α → β → β) (b : β) (l : List α) : β :=
foldr_with_index_aux f 0 b l
/-- `find_indexes p l` is the list of indexes of elements of `l` that satisfy `p`. -/
def find_indexes {α : Type u} (p : α → Prop) [decidable_pred p] (l : List α) : List ℕ :=
foldr_with_index (fun (i : ℕ) (a : α) (is : List ℕ) => ite (p a) (i :: is) is) [] l
/-- Returns the elements of `l` that satisfy `p` together with their indexes in
`l`. The returned list is ordered by index. -/
def indexes_values {α : Type u} (p : α → Prop) [decidable_pred p] (l : List α) : List (ℕ × α) :=
foldr_with_index (fun (i : ℕ) (a : α) (l : List (ℕ × α)) => ite (p a) ((i, a) :: l) l) [] l
/-- `indexes_of a l` is the list of all indexes of `a` in `l`. For example:
```
indexes_of a [a, b, a, a] = [0, 2, 3]
```
-/
def indexes_of {α : Type u} [DecidableEq α] (a : α) : List α → List ℕ :=
find_indexes (Eq a)
/-- Monadic variant of `foldl_with_index`. -/
def mfoldl_with_index {m : Type v → Type w} [Monad m] {α : Type u_1} {β : Type v} (f : ℕ → β → α → m β) (b : β) (as : List α) : m β :=
foldl_with_index
(fun (i : ℕ) (ma : m β) (b : α) =>
do
let a ← ma
f i a b)
(pure b) as
/-- Monadic variant of `foldr_with_index`. -/
def mfoldr_with_index {m : Type v → Type w} [Monad m] {α : Type u_1} {β : Type v} (f : ℕ → α → β → m β) (b : β) (as : List α) : m β :=
foldr_with_index
(fun (i : ℕ) (a : α) (mb : m β) =>
do
let b ← mb
f i a b)
(pure b) as
/-- Auxiliary definition for `mmap_with_index`. -/
def mmap_with_index_aux {m : Type v → Type w} [Applicative m] {α : Type u_1} {β : Type v} (f : ℕ → α → m β) : ℕ → List α → m (List β) :=
sorry
/-- Applicative variant of `map_with_index`. -/
def mmap_with_index {m : Type v → Type w} [Applicative m] {α : Type u_1} {β : Type v} (f : ℕ → α → m β) (as : List α) : m (List β) :=
mmap_with_index_aux f 0 as
/-- Auxiliary definition for `mmap_with_index'`. -/
def mmap_with_index'_aux {m : Type v → Type w} [Applicative m] {α : Type u_1} (f : ℕ → α → m PUnit) : ℕ → List α → m PUnit :=
sorry
/-- A variant of `mmap_with_index` specialised to applicative actions which
return `unit`. -/
def mmap_with_index' {m : Type v → Type w} [Applicative m] {α : Type u_1} (f : ℕ → α → m PUnit) (as : List α) : m PUnit :=
mmap_with_index'_aux f 0 as
/-- `lookmap` is a combination of `lookup` and `filter_map`.
`lookmap f l` will apply `f : α → option α` to each element of the list,
replacing `a → b` at the first value `a` in the list such that `f a = some b`. -/
def lookmap {α : Type u} (f : α → Option α) : List α → List α :=
sorry
/-- `countp p l` is the number of elements of `l` that satisfy `p`. -/
def countp {α : Type u} (p : α → Prop) [decidable_pred p] : List α → ℕ :=
sorry
/-- `count a l` is the number of occurrences of `a` in `l`. -/
def count {α : Type u} [DecidableEq α] (a : α) : List α → ℕ :=
countp (Eq a)
/-- `is_prefix l₁ l₂`, or `l₁ <+: l₂`, means that `l₁` is a prefix of `l₂`,
that is, `l₂` has the form `l₁ ++ t` for some `t`. -/
def is_prefix {α : Type u} (l₁ : List α) (l₂ : List α) :=
∃ (t : List α), l₁ ++ t = l₂
/-- `is_suffix l₁ l₂`, or `l₁ <:+ l₂`, means that `l₁` is a suffix of `l₂`,
that is, `l₂` has the form `t ++ l₁` for some `t`. -/
def is_suffix {α : Type u} (l₁ : List α) (l₂ : List α) :=
∃ (t : List α), t ++ l₁ = l₂
/-- `is_infix l₁ l₂`, or `l₁ <:+: l₂`, means that `l₁` is a contiguous
substring of `l₂`, that is, `l₂` has the form `s ++ l₁ ++ t` for some `s, t`. -/
def is_infix {α : Type u} (l₁ : List α) (l₂ : List α) :=
∃ (s : List α), ∃ (t : List α), s ++ l₁ ++ t = l₂
infixl:50 " <+: " => Mathlib.list.is_prefix
infixl:50 " <:+ " => Mathlib.list.is_suffix
infixl:50 " <:+: " => Mathlib.list.is_infix
/-- `inits l` is the list of initial segments of `l`.
inits [1, 2, 3] = [[], [1], [1, 2], [1, 2, 3]] -/
@[simp] def inits {α : Type u} : List α → List (List α) :=
sorry
/-- `tails l` is the list of terminal segments of `l`.
tails [1, 2, 3] = [[1, 2, 3], [2, 3], [3], []] -/
@[simp] def tails {α : Type u} : List α → List (List α) :=
sorry
def sublists'_aux {α : Type u} {β : Type v} : List α → (List α → List β) → List (List β) → List (List β) :=
sorry
/-- `sublists' l` is the list of all (non-contiguous) sublists of `l`.
It differs from `sublists` only in the order of appearance of the sublists;
`sublists'` uses the first element of the list as the MSB,
`sublists` uses the first element of the list as the LSB.
sublists' [1, 2, 3] = [[], [3], [2], [2, 3], [1], [1, 3], [1, 2], [1, 2, 3]] -/
def sublists' {α : Type u} (l : List α) : List (List α) :=
sublists'_aux l id []
def sublists_aux {α : Type u} {β : Type v} : List α → (List α → List β → List β) → List β :=
sorry
/-- `sublists l` is the list of all (non-contiguous) sublists of `l`; cf. `sublists'`
for a different ordering.
sublists [1, 2, 3] = [[], [1], [2], [1, 2], [3], [1, 3], [2, 3], [1, 2, 3]] -/
def sublists {α : Type u} (l : List α) : List (List α) :=
[] :: sublists_aux l List.cons
def sublists_aux₁ {α : Type u} {β : Type v} : List α → (List α → List β) → List β :=
sorry
/-- `forall₂ R l₁ l₂` means that `l₁` and `l₂` have the same length,
and whenever `a` is the nth element of `l₁`, and `b` is the nth element of `l₂`,
then `R a b` is satisfied. -/
inductive forall₂ {α : Type u} {β : Type v} (R : α → β → Prop) : List α → List β → Prop
where
| nil : forall₂ R [] []
| cons : ∀ {a : α} {b : β} {l₁ : List α} {l₂ : List β}, R a b → forall₂ R l₁ l₂ → forall₂ R (a :: l₁) (b :: l₂)
/-- Auxiliary definition used to define `transpose`.
`transpose_aux l L` takes each element of `l` and appends it to the start of
each element of `L`.
`transpose_aux [a, b, c] [l₁, l₂, l₃] = [a::l₁, b::l₂, c::l₃]` -/
def transpose_aux {α : Type u} : List α → List (List α) → List (List α) :=
sorry
/-- transpose of a list of lists, treated as a matrix.
transpose [[1, 2], [3, 4], [5, 6]] = [[1, 3, 5], [2, 4, 6]] -/
def transpose {α : Type u} : List (List α) → List (List α) :=
sorry
/-- List of all sections through a list of lists. A section
of `[L₁, L₂, ..., Lₙ]` is a list whose first element comes from
`L₁`, whose second element comes from `L₂`, and so on. -/
def sections {α : Type u} : List (List α) → List (List α) :=
sorry
def permutations_aux2 {α : Type u} {β : Type v} (t : α) (ts : List α) (r : List β) : List α → (List α → β) → List α × List β :=
sorry
def permutations_aux.rec {α : Type u} {C : List α → List α → Sort v} (H0 : (is : List α) → C [] is) (H1 : (t : α) → (ts is : List α) → C ts (t :: is) → C is [] → C (t :: ts) is) (l₁ : List α) (l₂ : List α) : C l₁ l₂ :=
sorry
def permutations_aux {α : Type u} : List α → List α → List (List α) :=
sorry
/-- List of all permutations of `l`.
permutations [1, 2, 3] =
[[1, 2, 3], [2, 1, 3], [3, 2, 1],
[2, 3, 1], [3, 1, 2], [1, 3, 2]] -/
def permutations {α : Type u} (l : List α) : List (List α) :=
l :: permutations_aux l []
/-- `erasep p l` removes the first element of `l` satisfying the predicate `p`. -/
def erasep {α : Type u} (p : α → Prop) [decidable_pred p] : List α → List α :=
sorry
/-- `extractp p l` returns a pair of an element `a` of `l` satisfying the predicate
`p`, and `l`, with `a` removed. If there is no such element `a` it returns `(none, l)`. -/
def extractp {α : Type u} (p : α → Prop) [decidable_pred p] : List α → Option α × List α :=
sorry
/-- `revzip l` returns a list of pairs of the elements of `l` paired
with the elements of `l` in reverse order.
`revzip [1,2,3,4,5] = [(1, 5), (2, 4), (3, 3), (4, 2), (5, 1)]`
-/
def revzip {α : Type u} (l : List α) : List (α × α) :=
zip l (reverse l)
/-- `product l₁ l₂` is the list of pairs `(a, b)` where `a ∈ l₁` and `b ∈ l₂`.
product [1, 2] [5, 6] = [(1, 5), (1, 6), (2, 5), (2, 6)] -/
def product {α : Type u} {β : Type v} (l₁ : List α) (l₂ : List β) : List (α × β) :=
list.bind l₁ fun (a : α) => map (Prod.mk a) l₂
/-- `sigma l₁ l₂` is the list of dependent pairs `(a, b)` where `a ∈ l₁` and `b ∈ l₂ a`.
sigma [1, 2] (λ_, [(5 : ℕ), 6]) = [(1, 5), (1, 6), (2, 5), (2, 6)] -/
protected def sigma {α : Type u} {σ : α → Type u_1} (l₁ : List α) (l₂ : (a : α) → List (σ a)) : List (sigma fun (a : α) => σ a) :=
list.bind l₁ fun (a : α) => map (sigma.mk a) (l₂ a)
/-- Auxliary definition used to define `of_fn`.
`of_fn_aux f m h l` returns the first `m` elements of `of_fn f`
appended to `l` -/
def of_fn_aux {α : Type u} {n : ℕ} (f : fin n → α) (m : ℕ) : m ≤ n → List α → List α :=
sorry
/-- `of_fn f` with `f : fin n → α` returns the list whose ith element is `f i`
`of_fun f = [f 0, f 1, ... , f(n - 1)]` -/
def of_fn {α : Type u} {n : ℕ} (f : fin n → α) : List α :=
of_fn_aux f n sorry []
/-- `of_fn_nth_val f i` returns `some (f i)` if `i < n` and `none` otherwise. -/
def of_fn_nth_val {α : Type u} {n : ℕ} (f : fin n → α) (i : ℕ) : Option α :=
dite (i < n) (fun (h : i < n) => some (f { val := i, property := h })) fun (h : ¬i < n) => none
/-- `disjoint l₁ l₂` means that `l₁` and `l₂` have no elements in common. -/
def disjoint {α : Type u} (l₁ : List α) (l₂ : List α) :=
∀ {a : α}, a ∈ l₁ → a ∈ l₂ → False
/-- `pairwise R l` means that all the elements with earlier indexes are
`R`-related to all the elements with later indexes.
pairwise R [1, 2, 3] ↔ R 1 2 ∧ R 1 3 ∧ R 2 3
For example if `R = (≠)` then it asserts `l` has no duplicates,
and if `R = (<)` then it asserts that `l` is (strictly) sorted. -/
inductive pairwise {α : Type u} (R : α → α → Prop) : List α → Prop
where
| nil : pairwise R []
| cons : ∀ {a : α} {l : List α}, (∀ (a' : α), a' ∈ l → R a a') → pairwise R l → pairwise R (a :: l)
@[simp] theorem pairwise_cons {α : Type u} {R : α → α → Prop} {a : α} {l : List α} : pairwise R (a :: l) ↔ (∀ (a' : α), a' ∈ l → R a a') ∧ pairwise R l := sorry
protected instance decidable_pairwise {α : Type u} {R : α → α → Prop} [DecidableRel R] (l : List α) : Decidable (pairwise R l) :=
List.rec (is_true pairwise.nil)
(fun (hd : α) (tl : List α) (ih : Decidable (pairwise R tl)) =>
decidable_of_iff' ((∀ (a' : α), a' ∈ tl → R hd a') ∧ pairwise R tl) pairwise_cons)
l
/-- `pw_filter R l` is a maximal sublist of `l` which is `pairwise R`.
`pw_filter (≠)` is the erase duplicates function (cf. `erase_dup`), and `pw_filter (<)` finds
a maximal increasing subsequence in `l`. For example,
pw_filter (<) [0, 1, 5, 2, 6, 3, 4] = [0, 1, 2, 3, 4] -/
def pw_filter {α : Type u} (R : α → α → Prop) [DecidableRel R] : List α → List α :=
sorry
/-- `chain R a l` means that `R` holds between adjacent elements of `a::l`.
chain R a [b, c, d] ↔ R a b ∧ R b c ∧ R c d -/
inductive chain {α : Type u} (R : α → α → Prop) : α → List α → Prop
where
| nil : ∀ {a : α}, chain R a []
| cons : ∀ {a b : α} {l : List α}, R a b → chain R b l → chain R a (b :: l)
/-- `chain' R l` means that `R` holds between adjacent elements of `l`.
chain' R [a, b, c, d] ↔ R a b ∧ R b c ∧ R c d -/
def chain' {α : Type u} (R : α → α → Prop) : List α → Prop :=
sorry
@[simp] theorem chain_cons {α : Type u} {R : α → α → Prop} {a : α} {b : α} {l : List α} : chain R a (b :: l) ↔ R a b ∧ chain R b l := sorry
protected instance decidable_chain {α : Type u} {R : α → α → Prop} [DecidableRel R] (a : α) (l : List α) : Decidable (chain R a l) :=
List.rec (fun (a : α) => eq.mpr sorry decidable.true)
(fun (l_hd : α) (l_tl : List α) (l_ih : (a : α) → Decidable (chain R a l_tl)) (a : α) => eq.mpr sorry and.decidable) l
a
protected instance decidable_chain' {α : Type u} {R : α → α → Prop} [DecidableRel R] (l : List α) : Decidable (chain' R l) :=
list.cases_on l (id decidable.true) fun (l_hd : α) (l_tl : List α) => id (list.decidable_chain l_hd l_tl)
/-- `nodup l` means that `l` has no duplicates, that is, any element appears at most
once in the list. It is defined as `pairwise (≠)`. -/
def nodup {α : Type u} : List α → Prop :=
pairwise ne
protected instance nodup_decidable {α : Type u} [DecidableEq α] (l : List α) : Decidable (nodup l) :=
list.decidable_pairwise
/-- `erase_dup l` removes duplicates from `l` (taking only the first occurrence).
Defined as `pw_filter (≠)`.
erase_dup [1, 0, 2, 2, 1] = [0, 2, 1] -/
def erase_dup {α : Type u} [DecidableEq α] : List α → List α :=
pw_filter ne
/-- `range' s n` is the list of numbers `[s, s+1, ..., s+n-1]`.
It is intended mainly for proving properties of `range` and `iota`. -/
@[simp] def range' : ℕ → ℕ → List ℕ :=
sorry
/-- Drop `none`s from a list, and replace each remaining `some a` with `a`. -/
def reduce_option {α : Type u_1} : List (Option α) → List α :=
filter_map id
/-- `ilast' x xs` returns the last element of `xs` if `xs` is non-empty;
it returns `x` otherwise -/
@[simp] def ilast' {α : Type u_1} : α → List α → α :=
sorry
/-- `last' xs` returns the last element of `xs` if `xs` is non-empty;
it returns `none` otherwise -/
@[simp] def last' {α : Type u_1} : List α → Option α :=
sorry
/-- `rotate l n` rotates the elements of `l` to the left by `n`
rotate [0, 1, 2, 3, 4, 5] 2 = [2, 3, 4, 5, 0, 1] -/
def rotate {α : Type u} (l : List α) (n : ℕ) : List α :=
sorry
/-- rotate' is the same as `rotate`, but slower. Used for proofs about `rotate`-/
def rotate' {α : Type u} : List α → ℕ → List α :=
sorry
/-- Given a decidable predicate `p` and a proof of existence of `a ∈ l` such that `p a`,
choose the first element with this property. This version returns both `a` and proofs
of `a ∈ l` and `p a`. -/
def choose_x {α : Type u} (p : α → Prop) [decidable_pred p] (l : List α) (hp : ∃ (a : α), a ∈ l ∧ p a) : Subtype fun (a : α) => a ∈ l ∧ p a :=
sorry
/-- Given a decidable predicate `p` and a proof of existence of `a ∈ l` such that `p a`,
choose the first element with this property. This version returns `a : α`, and properties
are given by `choose_mem` and `choose_property`. -/
def choose {α : Type u} (p : α → Prop) [decidable_pred p] (l : List α) (hp : ∃ (a : α), a ∈ l ∧ p a) : α :=
↑(choose_x p l hp)
/-- Filters and maps elements of a list -/
def mmap_filter {m : Type → Type v} [Monad m] {α : Type u_1} {β : Type} (f : α → m (Option β)) : List α → m (List β) :=
sorry
/--
`mmap_upper_triangle f l` calls `f` on all elements in the upper triangular part of `l × l`.
That is, for each `e ∈ l`, it will run `f e e` and then `f e e'`
for each `e'` that appears after `e` in `l`.
Example: suppose `l = [1, 2, 3]`. `mmap_upper_triangle f l` will produce the list
`[f 1 1, f 1 2, f 1 3, f 2 2, f 2 3, f 3 3]`.
-/
def mmap_upper_triangle {m : Type u → Type u_1} [Monad m] {α : Type u} {β : Type u} (f : α → α → m β) : List α → m (List β) :=
sorry
/--
`mmap'_diag f l` calls `f` on all elements in the upper triangular part of `l × l`.
That is, for each `e ∈ l`, it will run `f e e` and then `f e e'`
for each `e'` that appears after `e` in `l`.
Example: suppose `l = [1, 2, 3]`. `mmap'_diag f l` will evaluate, in this order,
`f 1 1`, `f 1 2`, `f 1 3`, `f 2 2`, `f 2 3`, `f 3 3`.
-/
def mmap'_diag {m : Type → Type u_1} [Monad m] {α : Type u_2} (f : α → α → m Unit) : List α → m Unit :=
sorry
protected def traverse {F : Type u → Type v} [Applicative F] {α : Type u_1} {β : Type u} (f : α → F β) : List α → F (List β) :=
sorry
/-- `get_rest l l₁` returns `some l₂` if `l = l₁ ++ l₂`.
If `l₁` is not a prefix of `l`, returns `none` -/
def get_rest {α : Type u} [DecidableEq α] : List α → List α → Option (List α) :=
sorry
/--
`list.slice n m xs` removes a slice of length `m` at index `n` in list `xs`.
-/
def slice {α : Type u_1} : ℕ → ℕ → List α → List α :=
sorry
/--
Left-biased version of `list.map₂`. `map₂_left' f as bs` applies `f` to each
pair of elements `aᵢ ∈ as` and `bᵢ ∈ bs`. If `bs` is shorter than `as`, `f` is
applied to `none` for the remaining `aᵢ`. Returns the results of the `f`
applications and the remaining `bs`.
```
map₂_left' prod.mk [1, 2] ['a'] = ([(1, some 'a'), (2, none)], [])
map₂_left' prod.mk [1] ['a', 'b'] = ([(1, some 'a')], ['b'])
```
-/
@[simp] def map₂_left' {α : Type u} {β : Type v} {γ : Type w} (f : α → Option β → γ) : List α → List β → List γ × List β :=
sorry
/--
Right-biased version of `list.map₂`. `map₂_right' f as bs` applies `f` to each
pair of elements `aᵢ ∈ as` and `bᵢ ∈ bs`. If `as` is shorter than `bs`, `f` is
applied to `none` for the remaining `bᵢ`. Returns the results of the `f`
applications and the remaining `as`.
```
map₂_right' prod.mk [1] ['a', 'b'] = ([(some 1, 'a'), (none, 'b')], [])
map₂_right' prod.mk [1, 2] ['a'] = ([(some 1, 'a')], [2])
```
-/
def map₂_right' {α : Type u} {β : Type v} {γ : Type w} (f : Option α → β → γ) (as : List α) (bs : List β) : List γ × List α :=
map₂_left' (flip f) bs as
/--
Left-biased version of `list.zip`. `zip_left' as bs` returns the list of
pairs `(aᵢ, bᵢ)` for `aᵢ ∈ as` and `bᵢ ∈ bs`. If `bs` is shorter than `as`, the
remaining `aᵢ` are paired with `none`. Also returns the remaining `bs`.
```
zip_left' [1, 2] ['a'] = ([(1, some 'a'), (2, none)], [])
zip_left' [1] ['a', 'b'] = ([(1, some 'a')], ['b'])
zip_left' = map₂_left' prod.mk
```
-/
def zip_left' {α : Type u} {β : Type v} : List α → List β → List (α × Option β) × List β :=
map₂_left' Prod.mk
/--
Right-biased version of `list.zip`. `zip_right' as bs` returns the list of
pairs `(aᵢ, bᵢ)` for `aᵢ ∈ as` and `bᵢ ∈ bs`. If `as` is shorter than `bs`, the
remaining `bᵢ` are paired with `none`. Also returns the remaining `as`.
```
zip_right' [1] ['a', 'b'] = ([(some 1, 'a'), (none, 'b')], [])
zip_right' [1, 2] ['a'] = ([(some 1, 'a')], [2])
zip_right' = map₂_right' prod.mk
```
-/
def zip_right' {α : Type u} {β : Type v} : List α → List β → List (Option α × β) × List α :=
map₂_right' Prod.mk
/--
Left-biased version of `list.map₂`. `map₂_left f as bs` applies `f` to each pair
`aᵢ ∈ as` and `bᵢ ∈ bs`. If `bs` is shorter than `as`, `f` is applied to `none`
for the remaining `aᵢ`.
```
map₂_left prod.mk [1, 2] ['a'] = [(1, some 'a'), (2, none)]
map₂_left prod.mk [1] ['a', 'b'] = [(1, some 'a')]
map₂_left f as bs = (map₂_left' f as bs).fst
```
-/
@[simp] def map₂_left {α : Type u} {β : Type v} {γ : Type w} (f : α → Option β → γ) : List α → List β → List γ :=
sorry
/--
Right-biased version of `list.map₂`. `map₂_right f as bs` applies `f` to each
pair `aᵢ ∈ as` and `bᵢ ∈ bs`. If `as` is shorter than `bs`, `f` is applied to
`none` for the remaining `bᵢ`.
```
map₂_right prod.mk [1, 2] ['a'] = [(some 1, 'a')]
map₂_right prod.mk [1] ['a', 'b'] = [(some 1, 'a'), (none, 'b')]
map₂_right f as bs = (map₂_right' f as bs).fst
```
-/
def map₂_right {α : Type u} {β : Type v} {γ : Type w} (f : Option α → β → γ) (as : List α) (bs : List β) : List γ :=
map₂_left (flip f) bs as
/--
Left-biased version of `list.zip`. `zip_left as bs` returns the list of pairs
`(aᵢ, bᵢ)` for `aᵢ ∈ as` and `bᵢ ∈ bs`. If `bs` is shorter than `as`, the
remaining `aᵢ` are paired with `none`.
```
zip_left [1, 2] ['a'] = [(1, some 'a'), (2, none)]
zip_left [1] ['a', 'b'] = [(1, some 'a')]
zip_left = map₂_left prod.mk
```
-/
def zip_left {α : Type u} {β : Type v} : List α → List β → List (α × Option β) :=
map₂_left Prod.mk
/--
Right-biased version of `list.zip`. `zip_right as bs` returns the list of pairs
`(aᵢ, bᵢ)` for `aᵢ ∈ as` and `bᵢ ∈ bs`. If `as` is shorter than `bs`, the
remaining `bᵢ` are paired with `none`.
```
zip_right [1, 2] ['a'] = [(some 1, 'a')]
zip_right [1] ['a', 'b'] = [(some 1, 'a'), (none, 'b')]
zip_right = map₂_right prod.mk
```
-/
def zip_right {α : Type u} {β : Type v} : List α → List β → List (Option α × β) :=
map₂_right Prod.mk
/--
If all elements of `xs` are `some xᵢ`, `all_some xs` returns the `xᵢ`. Otherwise
it returns `none`.
```
all_some [some 1, some 2] = some [1, 2]
all_some [some 1, none ] = none
```
-/
def all_some {α : Type u} : List (Option α) → Option (List α) :=
sorry
/--
`fill_nones xs ys` replaces the `none`s in `xs` with elements of `ys`. If there
are not enough `ys` to replace all the `none`s, the remaining `none`s are
dropped from `xs`.
```
fill_nones [none, some 1, none, none] [2, 3] = [2, 1, 3]
```
-/
def fill_nones {α : Type u_1} : List (Option α) → List α → List α :=
sorry
/--
`take_list as ns` extracts successive sublists from `as`. For `ns = n₁ ... nₘ`,
it first takes the `n₁` initial elements from `as`, then the next `n₂` ones,
etc. It returns the sublists of `as` -- one for each `nᵢ` -- and the remaining
elements of `as`. If `as` does not have at least as many elements as the sum of
the `nᵢ`, the corresponding sublists will have less than `nᵢ` elements.
```
take_list ['a', 'b', 'c', 'd', 'e'] [2, 1, 1] = ([['a', 'b'], ['c'], ['d']], ['e'])
take_list ['a', 'b'] [3, 1] = ([['a', 'b'], []], [])
```
-/
def take_list {α : Type u_1} : List α → List ℕ → List (List α) × List α :=
sorry
/--
`to_rbmap as` is the map that associates each index `i` of `as` with the
corresponding element of `as`.
```
to_rbmap ['a', 'b', 'c'] = rbmap_of [(0, 'a'), (1, 'b'), (2, 'c')]
```
-/
def to_rbmap {α : Type u} : List α → rbmap ℕ α :=
foldl_with_index (fun (i : ℕ) (mapp : rbmap ℕ α) (a : α) => rbmap.insert mapp i a) (mk_rbmap ℕ α)
|
Anderson was born June 26 , 1970 , in Studio City , California , to Edwina ( née Gough ) and Ernie Anderson . Ernie was an actor who was the voice of ABC and a Cleveland television late @-@ night horror movie host known as " <unk> " ( after whom Anderson later named his production company ) . Anderson grew up in the San Fernando Valley . He is third youngest of nine children , and had a troubled relationship with his mother but was close with his father , who encouraged him to become a writer or director . Anderson attended a number of schools , including Buckley in Sherman Oaks , John Thomas Dye School , Campbell Hall School , Cushing Academy and Montclair Prep .
|
using Plots
# Model
include_model("planar_push_block")
# Horizon
T = 26
# Time step
tf = 2.5
h = tf / (T-1)
# Bounds
_uu = Inf * ones(model.m)
_uu[model.idx_u] .= Inf
_uu[model.idx_u[1:8]] .= 5.0
_uu[model.idx_λ] .= 1.0
_ul = zeros(model.m)
_ul[model.idx_u] .= -Inf
_ul[model.idx_u[1:8]] .= -5.0
_ul[model.idx_λ] .= 1.0
ul, uu = control_bounds(model, T, _ul, _uu)
# Initial and final states
q1 = [0.0, 0.0, 0.0]
x1 = [q1; q1]
qT = [1.0; 0.0; 0.0]
xT = [qT; qT]
xl, xu = state_bounds(model, T, x1 = x1, xT = xT)
# Objective
include_objective("velocity")
obj_velocity = velocity_objective(
[t > T / 2 ? Diagonal(10.0 * ones(model.nq)) : Diagonal(1.0 * ones(model.nq)) for t = 1:T-1],
model.nq,
h = h,
idx_angle = collect([3]))
obj_tracking = quadratic_tracking_objective(
[Diagonal(1.0 * ones(model.n)) for t = 1:T],
# [Diagonal(0.1 * ones(model.m)) for t = 1:T-1],
[Diagonal([0.1 * ones(model.nu);
zeros(model.nc);
ones(model.nb);
zeros(model.m - model.nu - model.nc - model.nb)]) for t = 1:T-1],
[xT for t = 1:T],
[zeros(model.m) for t = 1:T])
obj_penalty = PenaltyObjective(1.0e4, model.m)
obj = MultiObjective([obj_tracking, obj_penalty, obj_velocity])
# Constraints
include_constraints(["contact", "stage"])
t_idx = vcat([t for t = 1:T-1])
function control_comp_con!(c, x, u, t)
q = x[nq .+ (1:nq)]
s = u[model.idx_s]
k = control_kinematics_func(model, q)
k_input = u[model.idx_u][9:10]
e1 = k[1:2] - k_input
e2 = k[3:4] - k_input
e3 = k[5:6] - k_input
e4 = k[7:8] - k_input
# e5 = k[9:10] - k_input
# e6 = k[11:12] - k_input
# e7 = k[13:14] - k_input
# e8 = k[15:16] - k_input
d1 = e1' * e1
d2 = e2' * e2
d3 = e3' * e3
d4 = e4' * e4
# d5 = e5' * e5
# d6 = e6' * e6
# d7 = e7' * e7
# d8 = e8' * e8
u_ctrl = u[model.idx_u]
c[1] = s[1] - u_ctrl[1] * d1
c[2] = s[1] + u_ctrl[1] * d1
c[3] = s[1] - u_ctrl[2] * d1
c[4] = s[1] + u_ctrl[2] * d1
c[5] = s[1] - u_ctrl[3] * d2
c[6] = s[1] + u_ctrl[3] * d2
c[7] = s[1] - u_ctrl[4] * d2
c[8] = s[1] + u_ctrl[4] * d2
c[9] = s[1] - u_ctrl[5] * d3
c[10] = s[1] + u_ctrl[5] * d3
c[11] = s[1] - u_ctrl[6] * d3
c[12] = s[1] + u_ctrl[6] * d3
c[13] = s[1] - u_ctrl[7] * d4
c[14] = s[1] + u_ctrl[7] * d4
c[15] = s[1] - u_ctrl[8] * d4
c[16] = s[1] + u_ctrl[8] * d4
# c[9] = s[1] - u[9] * d5
# c[10] = s[1] - u[10] * d5
#
# c[11] = s[1] - u[11] * d6
# c[12] = s[1] - u[12] * d6
#
# c[13] = s[1] - u[13] * d7
# c[14] = s[1] - u[14] * d7
#
# c[15] = s[1] - u[15] * d8
# c[16] = s[1] - u[16] * d8
nothing
end
n_ctrl_comp = 16
con_ctrl_comp = stage_constraints(control_comp_con!, n_ctrl_comp, (1:16), t_idx)
function control_limits_con!(c, x, u, t)
q = x[nq .+ (1:nq)]
θ = q[3]
R = rotation_matrix(θ)
u_ctrl = u[model.idx_u]
c[1] = -1.0 * (R' * u_ctrl[1:2])[1]
c[2] = (model.μ[end] * u_ctrl[1])^2.0 - u_ctrl[2]^2.0
c[3] = -1.0 * (R' * u_ctrl[3:4])[2]
c[4] = (model.μ[end] * u_ctrl[4])^2.0 - u_ctrl[3]^2.0
c[5] = (R' * u_ctrl[5:6])[1]
c[6] = (model.μ[end] * u_ctrl[5])^2.0 - u_ctrl[6]^2.0
c[7] = (R' * u_ctrl[7:8])[2]
c[8] = (model.μ[end] * u_ctrl[8])^2.0 - u_ctrl[7]^2.0
end
n_ctrl_lim = 8
con_ctrl_lim = stage_constraints(control_limits_con!, n_ctrl_lim, (1:8), t_idx)
con_contact = contact_constraints(model, T)
con = multiple_constraints([con_contact, con_ctrl_comp, con_ctrl_lim])
# Problem
prob = trajectory_optimization_problem(model,
obj,
T,
h = h,
xl = xl,
xu = xu,
ul = ul,
uu = uu,
con = con)
# Trajectory initialization
x0 = linear_interpolation(x1, xT, T) # linear interpolation on state
u0 = [0.001 * rand(model.m) for t = 1:T-1] # random controls
# Pack trajectories into vector
z0 = pack(x0, u0, prob)
#NOTE: may need to run examples multiple times to get good trajectories
# Solve nominal problem
@time z̄, info = solve(prob, copy(z0), tol = 1.0e-3, c_tol = 1.0e-3)
check_slack(z̄, prob)
x̄, ū = unpack(z̄, prob)
q̄ = state_to_configuration(x̄)
q = state_to_configuration(x̄)
u = [u[model.idx_u] for u in ū]
γ = [u[model.idx_λ] for u in ū]
b = [u[model.idx_b] for u in ū]
h̄ = h
include(joinpath(pwd(), "models/visualize.jl"))
vis = Visualizer()
render(vis)
#open(vis)
visualize!(vis, model,
q̄, ū,
Δt = h)
# settransform!(vis["/Cameras/default"],
# compose(Translation(0.0, 0.0, 50.0), LinearMap(RotZ(0.5 * pi) * RotY(-pi/2.5))))
# setprop!(vis["/Cameras/default/rotated/<object>"], "zoom", 25)
plot(hcat(q̄...)', color = :red, width = 1.0, labels = "")
plot(hcat([ū..., ū[end]]...)[model.idx_u[1:8], :]', linetype = :steppost, color = :black, width = 1.0, labels = "")
|
!**************************************************************
!* AceGen 6.702 Windows (4 May 16) *
!* Co. J. Korelc 2013 18 Mar 17 18:52:48 *
!**************************************************************
! User : Full professional version
! Notebook : dRdFFunction
! Evaluation time : 16 s Mode : Optimal
! Number of formulae : 416 Method: Automatic
! Subroutine : dRdF1 size: 7654
! Total size of Mathematica code : 7654 subexpressions
! Total size of Fortran code : 19447 bytes
!******************* S U B R O U T I N E **********************
SUBROUTINE dRdF1(v,x,props,statev,Fnew,dRdF)
USE SMSUtility
IMPLICIT NONE
LOGICAL b126
DOUBLE PRECISION v(694),x(19),props(9),statev(19),Fnew(9),dRdF(19,9)
v(675)=props(4)*x(1)
v(624)=-(x(10)*x(2))
v(623)=x(5)*x(7)
v(622)=-(x(4)*x(9))
v(621)=x(6)*x(7)
v(620)=x(5)*x(6)-x(3)*x(8)
v(619)=x(10)*x(9)
v(618)=-(x(3)*x(7))
v(617)=-(x(2)*x(6))+x(8)*x(9)
v(616)=x(10)*x(8)
v(615)=-(x(4)*x(5))
v(614)=x(2)*x(3)-x(5)*x(9)
v(613)=-(x(7)*x(8))
v(612)=x(2)*x(4)
v(611)=-(x(10)*x(6))
v(610)=x(3)*x(4)
v(609)=x(12)*x(13)-x(15)*x(19)
v(608)=-(x(13)*x(14))+x(17)*x(19)
v(607)=x(14)*x(16)-x(11)*x(19)
v(606)=-(x(12)*x(16))+x(18)*x(19)
v(605)=x(15)*x(16)-x(13)*x(18)
v(604)=-(x(11)*x(15))+x(17)*x(18)
v(603)=x(11)*x(12)-x(14)*x(18)
v(602)=x(11)*x(13)-x(16)*x(17)
v(601)=x(14)*x(15)-x(12)*x(17)
v(600)=1d0/(v(617)*x(10)+v(614)*x(4)+v(620)*x(7))
v(599)=-statev(1)+x(1)
v(598)=1d0-props(6)
v(678)=props(8)*v(598)
v(57)=v(600)*(v(610)+v(611))
v(59)=v(600)*(v(612)+v(613))
v(60)=v(600)*v(614)
v(61)=v(600)*(v(615)+v(616))
v(62)=v(600)*v(617)
v(63)=v(600)*(v(618)+v(619))
v(64)=v(600)*v(620)
v(65)=v(600)*(v(621)+v(622))
v(66)=v(600)*(v(623)+v(624))
v(67)=Fnew(1)*v(57)+Fnew(7)*v(63)+Fnew(4)*v(65)
v(625)=2d0*v(67)
v(189)=v(625)*v(63)
v(198)=-v(189)/3d0
v(186)=v(625)*v(65)
v(195)=-v(186)/3d0
v(183)=v(57)*v(625)
v(192)=-v(183)/3d0
v(68)=Fnew(2)*v(59)+Fnew(8)*v(61)+Fnew(5)*v(66)
v(626)=2d0*v(68)
v(208)=v(61)*v(626)
v(217)=-v(208)/3d0
v(205)=v(626)*v(66)
v(214)=-v(205)/3d0
v(202)=v(59)*v(626)
v(211)=-v(202)/3d0
v(69)=Fnew(3)*v(60)+Fnew(9)*v(62)+Fnew(6)*v(64)
v(627)=2d0*v(69)
v(227)=v(62)*v(627)
v(236)=-v(227)/3d0
v(224)=v(627)*v(64)
v(233)=-v(224)/3d0
v(221)=v(60)*v(627)
v(230)=-v(221)/3d0
v(70)=Fnew(4)*v(59)+Fnew(1)*v(61)+Fnew(7)*v(66)
v(628)=2d0*v(70)
v(243)=v(66)*v(67)+v(63)*v(70)
v(240)=v(59)*v(67)+v(65)*v(70)
v(237)=v(61)*v(67)+v(57)*v(70)
v(207)=v(628)*v(66)
v(216)=-v(207)/3d0
v(204)=v(59)*v(628)
v(213)=-v(204)/3d0
v(201)=v(61)*v(628)
v(210)=-v(201)/3d0
v(71)=Fnew(5)*v(60)+Fnew(2)*v(62)+Fnew(8)*v(64)
v(629)=2d0*v(71)
v(253)=v(64)*v(68)+v(61)*v(71)
v(250)=v(60)*v(68)+v(66)*v(71)
v(247)=v(62)*v(68)+v(59)*v(71)
v(226)=v(629)*v(64)
v(235)=-v(226)/3d0
v(223)=v(60)*v(629)
v(232)=-v(223)/3d0
v(220)=v(62)*v(629)
v(229)=-v(220)/3d0
v(72)=Fnew(6)*v(57)+Fnew(3)*v(63)+Fnew(9)*v(65)
v(630)=2d0*v(72)
v(263)=v(65)*v(69)+v(62)*v(72)
v(260)=v(57)*v(69)+v(64)*v(72)
v(257)=v(63)*v(69)+v(60)*v(72)
v(191)=v(630)*v(65)
v(200)=-v(191)/3d0
v(188)=v(57)*v(630)
v(197)=-v(188)/3d0
v(185)=v(63)*v(630)
v(194)=-v(185)/3d0
v(73)=Fnew(7)*v(60)+Fnew(4)*v(62)+Fnew(1)*v(64)
v(631)=2d0*v(73)
v(261)=v(60)*v(67)+v(63)*v(73)
v(258)=v(62)*v(67)+v(65)*v(73)
v(255)=v(64)*v(67)+v(57)*v(73)
v(252)=v(60)*v(70)+v(66)*v(73)
v(249)=v(62)*v(70)+v(59)*v(73)
v(246)=v(64)*v(70)+v(61)*v(73)
v(225)=v(60)*v(631)
v(234)=-v(225)/3d0
v(222)=v(62)*v(631)
v(231)=-v(222)/3d0
v(219)=v(631)*v(64)
v(228)=-v(219)/3d0
v(74)=Fnew(8)*v(57)+Fnew(5)*v(63)+Fnew(2)*v(65)
v(632)=2d0*v(74)
v(262)=v(57)*v(71)+v(64)*v(74)
v(259)=v(63)*v(71)+v(60)*v(74)
v(256)=v(65)*v(71)+v(62)*v(74)
v(244)=v(57)*v(68)+v(61)*v(74)
v(241)=v(63)*v(68)+v(66)*v(74)
v(238)=v(65)*v(68)+v(59)*v(74)
v(190)=v(57)*v(632)
v(199)=-v(190)/3d0
v(187)=v(63)*v(632)
v(196)=-v(187)/3d0
v(184)=v(632)*v(65)
v(193)=-v(184)/3d0
v(75)=Fnew(9)*v(59)+Fnew(6)*v(61)+Fnew(3)*v(66)
v(633)=2d0*v(75)
v(254)=v(59)*v(69)+v(62)*v(75)
v(251)=v(61)*v(69)+v(64)*v(75)
v(248)=v(66)*v(69)+v(60)*v(75)
v(245)=v(59)*v(72)+v(65)*v(75)
v(242)=v(61)*v(72)+v(57)*v(75)
v(239)=v(66)*v(72)+v(63)*v(75)
v(209)=v(59)*v(633)
v(218)=-v(209)/3d0
v(206)=v(61)*v(633)
v(215)=-v(206)/3d0
v(203)=v(633)*v(66)
v(212)=-v(203)/3d0
v(76)=(v(67)*v(67))+(v(72)*v(72))+(v(74)*v(74))
v(88)=-v(76)/3d0
v(77)=(v(68)*v(68))+(v(70)*v(70))+(v(75)*v(75))
v(89)=-v(77)/3d0
v(78)=(v(69)*v(69))+(v(71)*v(71))+(v(73)*v(73))
v(323)=(2d0/3d0)*v(78)+v(88)+v(89)
v(84)=-v(78)/3d0
v(313)=(2d0/3d0)*v(77)+v(84)+v(88)
v(303)=(2d0/3d0)*v(76)+v(84)+v(89)
v(79)=v(67)*v(70)+v(68)*v(74)+v(72)*v(75)
v(634)=2d0*v(79)
v(269)=-(v(634)*v(78))
v(266)=(v(79)*v(79))
v(638)=-v(266)+v(76)*v(77)
v(80)=v(68)*v(71)+v(70)*v(73)+v(69)*v(75)
v(272)=v(634)*v(80)
v(270)=(-2d0)*v(76)*v(80)
v(264)=(v(80)*v(80))
v(636)=-v(264)+v(77)*v(78)
v(81)=v(69)*v(72)+v(67)*v(73)+v(71)*v(74)
v(635)=2d0*v(81)
v(273)=-(v(635)*v(77))
v(641)=v(272)+v(273)
v(271)=v(635)*v(79)
v(640)=v(270)+v(271)
v(267)=v(635)*v(80)
v(639)=v(267)+v(269)
v(265)=(v(81)*v(81))
v(637)=-v(265)+v(76)*v(78)
v(281)=v(191)*v(636)+v(209)*v(637)+v(227)*v(638)+v(245)*v(639)+v(254)*v(640)+v(263)*v(641)
v(280)=v(190)*v(636)+v(208)*v(637)+v(226)*v(638)+v(244)*v(639)+v(253)*v(640)+v(262)*v(641)
v(279)=v(189)*v(636)+v(207)*v(637)+v(225)*v(638)+v(243)*v(639)+v(252)*v(640)+v(261)*v(641)
v(278)=v(188)*v(636)+v(206)*v(637)+v(224)*v(638)+v(242)*v(639)+v(251)*v(640)+v(260)*v(641)
v(277)=v(187)*v(636)+v(205)*v(637)+v(223)*v(638)+v(241)*v(639)+v(250)*v(640)+v(259)*v(641)
v(276)=v(186)*v(636)+v(204)*v(637)+v(222)*v(638)+v(240)*v(639)+v(249)*v(640)+v(258)*v(641)
v(275)=v(185)*v(636)+v(203)*v(637)+v(221)*v(638)+v(239)*v(639)+v(248)*v(640)+v(257)*v(641)
v(274)=v(184)*v(636)+v(202)*v(637)+v(220)*v(638)+v(238)*v(639)+v(247)*v(640)+v(256)*v(641)
v(268)=v(183)*v(636)+v(201)*v(637)+v(219)*v(638)+v(237)*v(639)+v(246)*v(640)+v(255)*v(641)
v(82)=-(v(264)*v(76))-v(265)*v(77)+v(638)*v(78)+v(267)*v(79)
v(294)=1d0/v(82)**0.13333333333333333d1
v(642)=-v(294)/3d0
v(302)=v(281)*v(642)
v(301)=v(280)*v(642)
v(300)=v(279)*v(642)
v(299)=v(278)*v(642)
v(298)=v(277)*v(642)
v(297)=v(276)*v(642)
v(296)=v(275)*v(642)
v(295)=v(274)*v(642)
v(293)=v(268)*v(642)
v(282)=sqrt(v(82))
v(86)=props(2)*(-v(282)+v(82))
v(85)=1d0/v(82)**0.3333333333333333d0
v(673)=props(1)*v(85)
v(670)=props(1)*(v(293)*v(303)+((2d0/3d0)*v(183)+v(210)+v(228))*v(85))
v(669)=props(1)*(v(293)*v(323)+(v(192)+v(210)+(2d0/3d0)*v(219))*v(85))
v(668)=props(1)*(v(293)*v(313)+(v(192)+(2d0/3d0)*v(201)+v(228))*v(85))
v(667)=props(1)*(v(295)*v(303)+((2d0/3d0)*v(184)+v(211)+v(229))*v(85))
v(666)=props(1)*(v(295)*v(323)+(v(193)+v(211)+(2d0/3d0)*v(220))*v(85))
v(665)=props(1)*(v(295)*v(313)+(v(193)+(2d0/3d0)*v(202)+v(229))*v(85))
v(664)=props(1)*(v(296)*v(303)+((2d0/3d0)*v(185)+v(212)+v(230))*v(85))
v(663)=props(1)*(v(296)*v(323)+(v(194)+v(212)+(2d0/3d0)*v(221))*v(85))
v(662)=props(1)*(v(296)*v(313)+(v(194)+(2d0/3d0)*v(203)+v(230))*v(85))
v(661)=props(1)*(v(297)*v(303)+((2d0/3d0)*v(186)+v(213)+v(231))*v(85))
v(660)=props(1)*(v(297)*v(323)+(v(195)+v(213)+(2d0/3d0)*v(222))*v(85))
v(659)=props(1)*(v(297)*v(313)+(v(195)+(2d0/3d0)*v(204)+v(231))*v(85))
v(658)=props(1)*(v(298)*v(303)+((2d0/3d0)*v(187)+v(214)+v(232))*v(85))
v(657)=props(1)*(v(298)*v(323)+(v(196)+v(214)+(2d0/3d0)*v(223))*v(85))
v(656)=props(1)*(v(298)*v(313)+(v(196)+(2d0/3d0)*v(205)+v(232))*v(85))
v(655)=props(1)*(v(299)*v(303)+((2d0/3d0)*v(188)+v(215)+v(233))*v(85))
v(654)=props(1)*(v(299)*v(323)+(v(197)+v(215)+(2d0/3d0)*v(224))*v(85))
v(653)=props(1)*(v(299)*v(313)+(v(197)+(2d0/3d0)*v(206)+v(233))*v(85))
v(652)=props(1)*(v(300)*v(303)+((2d0/3d0)*v(189)+v(216)+v(234))*v(85))
v(651)=props(1)*(v(300)*v(323)+(v(198)+v(216)+(2d0/3d0)*v(225))*v(85))
v(650)=props(1)*(v(300)*v(313)+(v(198)+(2d0/3d0)*v(207)+v(234))*v(85))
v(649)=props(1)*(v(301)*v(303)+((2d0/3d0)*v(190)+v(217)+v(235))*v(85))
v(648)=props(1)*(v(301)*v(323)+(v(199)+v(217)+(2d0/3d0)*v(226))*v(85))
v(647)=props(1)*(v(301)*v(313)+(v(199)+(2d0/3d0)*v(208)+v(235))*v(85))
v(646)=props(1)*(v(302)*v(303)+((2d0/3d0)*v(191)+v(218)+v(236))*v(85))
v(645)=props(1)*(v(302)*v(323)+(v(200)+v(218)+(2d0/3d0)*v(227))*v(85))
v(644)=props(1)*(v(302)*v(313)+(v(200)+(2d0/3d0)*v(209)+v(236))*v(85))
v(359)=props(1)*(v(302)*v(81)+v(263)*v(85))
v(358)=props(1)*(v(301)*v(81)+v(262)*v(85))
v(357)=props(1)*(v(300)*v(81)+v(261)*v(85))
v(356)=props(1)*(v(299)*v(81)+v(260)*v(85))
v(355)=props(1)*(v(298)*v(81)+v(259)*v(85))
v(354)=props(1)*(v(297)*v(81)+v(258)*v(85))
v(353)=props(1)*(v(296)*v(81)+v(257)*v(85))
v(352)=props(1)*(v(295)*v(81)+v(256)*v(85))
v(351)=props(1)*(v(293)*v(81)+v(255)*v(85))
v(350)=props(1)*(v(302)*v(80)+v(254)*v(85))
v(349)=props(1)*(v(301)*v(80)+v(253)*v(85))
v(348)=props(1)*(v(300)*v(80)+v(252)*v(85))
v(347)=props(1)*(v(299)*v(80)+v(251)*v(85))
v(346)=props(1)*(v(298)*v(80)+v(250)*v(85))
v(345)=props(1)*(v(297)*v(80)+v(249)*v(85))
v(344)=props(1)*(v(296)*v(80)+v(248)*v(85))
v(343)=props(1)*(v(295)*v(80)+v(247)*v(85))
v(342)=props(1)*(v(293)*v(80)+v(246)*v(85))
v(341)=props(1)*(v(302)*v(79)+v(245)*v(85))
v(340)=props(1)*(v(301)*v(79)+v(244)*v(85))
v(339)=props(1)*(v(300)*v(79)+v(243)*v(85))
v(338)=props(1)*(v(299)*v(79)+v(242)*v(85))
v(337)=props(1)*(v(298)*v(79)+v(241)*v(85))
v(336)=props(1)*(v(297)*v(79)+v(240)*v(85))
v(335)=props(1)*(v(296)*v(79)+v(239)*v(85))
v(334)=props(1)*(v(295)*v(79)+v(238)*v(85))
v(333)=props(1)*(v(293)*v(79)+v(237)*v(85))
v(94)=1d0/(v(603)*x(13)+v(601)*x(16)+v(604)*x(19))**2
v(100)=1d0/v(94)**0.3333333333333333d0
v(671)=props(7)*v(100)
v(672)=v(671)*v(94)
v(95)=((v(601)*v(601))+(v(603)*v(603))+(v(604)*v(604)))*v(94)
v(99)=-v(95)/3d0
v(96)=((v(602)*v(602))+(v(607)*v(607))+(v(608)*v(608)))*v(94)
v(102)=-v(96)/3d0
v(97)=((v(605)*v(605))+(v(606)*v(606))+(v(609)*v(609)))*v(94)
v(103)=-v(97)/3d0
v(98)=v(671)*(v(102)+(2d0/3d0)*v(97)+v(99))
v(101)=v(671)*(v(103)+(2d0/3d0)*v(96)+v(99))
v(104)=v(671)*(v(102)+v(103)+(2d0/3d0)*v(95))
v(112)=(v(602)*v(605)+v(606)*v(607)+v(608)*v(609))*v(672)
v(679)=2d0*v(112)
v(117)=(v(602)*v(604)+v(603)*v(607)+v(601)*v(608))*v(672)
v(680)=2d0*v(117)
v(119)=(v(604)*v(605)+v(603)*v(606)+v(601)*v(609))*v(672)
v(681)=2d0*v(119)
v(120)=v(303)*v(673)+v(86)-v(98)
v(121)=-v(101)+v(313)*v(673)+v(86)
v(122)=-v(104)+v(323)*v(673)+v(86)
v(123)=-v(112)+v(673)*v(79)
v(684)=4d0*v(123)
v(124)=-v(117)+v(673)*v(80)
v(685)=4d0*v(124)
v(125)=-v(119)+v(673)*v(81)
v(686)=4d0*v(125)
IF(dabs(props(5)).lt.0.1d-11) THEN
v(674)=v(675)
v(127)=v(674)
ELSE
v(676)=1d0/props(5)
v(127)=v(676)*(1d0-dexp(-(props(5)*v(675))))
ENDIF
v(135)=1d0/(props(3)+v(127))
v(677)=0.15d1*v(135)
v(485)=v(359)*v(677)
v(531)=-(v(485)*v(599))
v(484)=v(358)*v(677)
v(530)=-(v(484)*v(599))
v(483)=v(357)*v(677)
v(529)=-(v(483)*v(599))
v(482)=v(356)*v(677)
v(528)=-(v(482)*v(599))
v(481)=v(355)*v(677)
v(527)=-(v(481)*v(599))
v(480)=v(354)*v(677)
v(526)=-(v(480)*v(599))
v(479)=v(353)*v(677)
v(525)=-(v(479)*v(599))
v(478)=v(352)*v(677)
v(524)=-(v(478)*v(599))
v(477)=v(351)*v(677)
v(523)=-(v(477)*v(599))
v(467)=v(350)*v(677)
v(476)=-(v(467)*v(599))
v(466)=v(349)*v(677)
v(475)=-(v(466)*v(599))
v(465)=v(348)*v(677)
v(474)=-(v(465)*v(599))
v(464)=v(347)*v(677)
v(473)=-(v(464)*v(599))
v(463)=v(346)*v(677)
v(472)=-(v(463)*v(599))
v(462)=v(345)*v(677)
v(471)=-(v(462)*v(599))
v(461)=v(344)*v(677)
v(470)=-(v(461)*v(599))
v(460)=v(343)*v(677)
v(469)=-(v(460)*v(599))
v(459)=v(342)*v(677)
v(468)=-(v(459)*v(599))
v(449)=v(341)*v(677)
v(458)=-(v(449)*v(599))
v(448)=v(340)*v(677)
v(457)=-(v(448)*v(599))
v(447)=v(339)*v(677)
v(456)=-(v(447)*v(599))
v(446)=v(338)*v(677)
v(455)=-(v(446)*v(599))
v(445)=v(337)*v(677)
v(454)=-(v(445)*v(599))
v(444)=v(336)*v(677)
v(453)=-(v(444)*v(599))
v(443)=v(335)*v(677)
v(452)=-(v(443)*v(599))
v(442)=v(334)*v(677)
v(451)=-(v(442)*v(599))
v(441)=v(333)*v(677)
v(450)=-(v(441)*v(599))
v(440)=v(645)*v(677)
v(439)=v(648)*v(677)
v(438)=v(651)*v(677)
v(437)=v(654)*v(677)
v(436)=v(657)*v(677)
v(435)=v(660)*v(677)
v(434)=v(663)*v(677)
v(433)=v(666)*v(677)
v(432)=v(669)*v(677)
v(431)=v(644)*v(677)
v(430)=v(647)*v(677)
v(429)=v(650)*v(677)
v(428)=v(653)*v(677)
v(427)=v(656)*v(677)
v(426)=v(659)*v(677)
v(425)=v(662)*v(677)
v(424)=v(665)*v(677)
v(423)=v(668)*v(677)
v(422)=v(646)*v(677)
v(495)=v(678)*(v(101)*v(431)+v(104)*v(440)+v(449)*v(679)+v(467)*v(680)+v(485)*v(681)+v(422)*v(98))
v(421)=v(649)*v(677)
v(494)=v(678)*(v(101)*v(430)+v(104)*v(439)+v(448)*v(679)+v(466)*v(680)+v(484)*v(681)+v(421)*v(98))
v(420)=v(652)*v(677)
v(493)=v(678)*(v(101)*v(429)+v(104)*v(438)+v(447)*v(679)+v(465)*v(680)+v(483)*v(681)+v(420)*v(98))
v(419)=v(655)*v(677)
v(492)=v(678)*(v(101)*v(428)+v(104)*v(437)+v(446)*v(679)+v(464)*v(680)+v(482)*v(681)+v(419)*v(98))
v(418)=v(658)*v(677)
v(491)=v(678)*(v(101)*v(427)+v(104)*v(436)+v(445)*v(679)+v(463)*v(680)+v(481)*v(681)+v(418)*v(98))
v(417)=v(661)*v(677)
v(490)=v(678)*(v(101)*v(426)+v(104)*v(435)+v(444)*v(679)+v(462)*v(680)+v(480)*v(681)+v(417)*v(98))
v(416)=v(664)*v(677)
v(489)=v(678)*(v(101)*v(425)+v(104)*v(434)+v(443)*v(679)+v(461)*v(680)+v(479)*v(681)+v(416)*v(98))
v(415)=v(667)*v(677)
v(488)=v(678)*(v(101)*v(424)+v(104)*v(433)+v(442)*v(679)+v(460)*v(680)+v(478)*v(681)+v(415)*v(98))
v(414)=v(670)*v(677)
v(487)=v(678)*(v(101)*v(423)+v(104)*v(432)+v(441)*v(679)+v(459)*v(680)+v(477)*v(681)+v(414)*v(98))
v(128)=-v(121)/3d0
v(129)=-v(122)/3d0
v(132)=(2d0/3d0)*v(120)+v(128)+v(129)
v(689)=2d0*v(132)
v(130)=-v(120)/3d0
v(137)=(2d0/3d0)*v(122)+v(128)+v(130)
v(688)=2d0*v(137)
v(134)=(2d0/3d0)*v(121)+v(129)+v(130)
v(687)=2d0*v(134)
v(534)=1d0/sqrt(0.15d1*(2d0*v(123)**2+2d0*v(124)**2+2d0*v(125)**2+v(132)**2+v(134)**2+v(137)**2))
v(683)=0.75d0*v(534)
v(133)=v(132)*v(677)
v(136)=v(134)*v(677)
v(138)=v(137)*v(677)
v(139)=v(123)*v(677)
v(140)=v(124)*v(677)
v(141)=v(125)*v(677)
v(170)=v(678)*(v(101)*v(136)+v(104)*v(138)+v(139)*v(679)+v(140)*v(680)+v(141)*v(681)+v(133)*v(98))
v(682)=(-1d0)+v(170)
v(522)=-(v(599)*(v(141)*v(495)+v(485)*v(682)))
v(521)=-(v(599)*(v(141)*v(494)+v(484)*v(682)))
v(520)=-(v(599)*(v(141)*v(493)+v(483)*v(682)))
v(519)=-(v(599)*(v(141)*v(492)+v(482)*v(682)))
v(518)=-(v(599)*(v(141)*v(491)+v(481)*v(682)))
v(517)=-(v(599)*(v(141)*v(490)+v(480)*v(682)))
v(516)=-(v(599)*(v(141)*v(489)+v(479)*v(682)))
v(515)=-(v(599)*(v(141)*v(488)+v(478)*v(682)))
v(514)=-(v(599)*(v(141)*v(487)+v(477)*v(682)))
v(513)=-(v(599)*(v(139)*v(495)+v(449)*v(682)))
v(512)=-(v(599)*(v(139)*v(494)+v(448)*v(682)))
v(511)=-(v(599)*(v(139)*v(493)+v(447)*v(682)))
v(510)=-(v(599)*(v(139)*v(492)+v(446)*v(682)))
v(509)=-(v(599)*(v(139)*v(491)+v(445)*v(682)))
v(508)=-(v(599)*(v(139)*v(490)+v(444)*v(682)))
v(507)=-(v(599)*(v(139)*v(489)+v(443)*v(682)))
v(506)=-(v(599)*(v(139)*v(488)+v(442)*v(682)))
v(505)=-(v(599)*(v(139)*v(487)+v(441)*v(682)))
v(504)=-(v(599)*(v(140)*v(495)+v(467)*v(682)))
v(503)=-(v(599)*(v(140)*v(494)+v(466)*v(682)))
v(502)=-(v(599)*(v(140)*v(493)+v(465)*v(682)))
v(501)=-(v(599)*(v(140)*v(492)+v(464)*v(682)))
v(500)=-(v(599)*(v(140)*v(491)+v(463)*v(682)))
v(499)=-(v(599)*(v(140)*v(490)+v(462)*v(682)))
v(498)=-(v(599)*(v(140)*v(489)+v(461)*v(682)))
v(497)=-(v(599)*(v(140)*v(488)+v(460)*v(682)))
v(496)=-(v(599)*(v(140)*v(487)+v(459)*v(682)))
dRdF(1,1)=v(683)*(v(333)*v(684)+v(342)*v(685)+v(351)*v(686)+v(668)*v(687)+v(669)*v(688)+v(670)*v(689))
dRdF(1,2)=v(683)*(v(334)*v(684)+v(343)*v(685)+v(352)*v(686)+v(665)*v(687)+v(666)*v(688)+v(667)*v(689))
dRdF(1,3)=v(683)*(v(335)*v(684)+v(344)*v(685)+v(353)*v(686)+v(662)*v(687)+v(663)*v(688)+v(664)*v(689))
dRdF(1,4)=v(683)*(v(336)*v(684)+v(345)*v(685)+v(354)*v(686)+v(659)*v(687)+v(660)*v(688)+v(661)*v(689))
dRdF(1,5)=v(683)*(v(337)*v(684)+v(346)*v(685)+v(355)*v(686)+v(656)*v(687)+v(657)*v(688)+v(658)*v(689))
dRdF(1,6)=v(683)*(v(338)*v(684)+v(347)*v(685)+v(356)*v(686)+v(653)*v(687)+v(654)*v(688)+v(655)*v(689))
dRdF(1,7)=v(683)*(v(339)*v(684)+v(348)*v(685)+v(357)*v(686)+v(650)*v(687)+v(651)*v(688)+v(652)*v(689))
dRdF(1,8)=v(683)*(v(340)*v(684)+v(349)*v(685)+v(358)*v(686)+v(647)*v(687)+v(648)*v(688)+v(649)*v(689))
dRdF(1,9)=v(683)*(v(341)*v(684)+v(350)*v(685)+v(359)*v(686)+v(644)*v(687)+v(645)*v(688)+v(646)*v(689))
dRdF(2,1)=-(v(414)*v(599))
dRdF(2,2)=-(v(415)*v(599))
dRdF(2,3)=-(v(416)*v(599))
dRdF(2,4)=-(v(417)*v(599))
dRdF(2,5)=-(v(418)*v(599))
dRdF(2,6)=-(v(419)*v(599))
dRdF(2,7)=-(v(420)*v(599))
dRdF(2,8)=-(v(421)*v(599))
dRdF(2,9)=-(v(422)*v(599))
dRdF(3,1)=-(v(423)*v(599))
dRdF(3,2)=-(v(424)*v(599))
dRdF(3,3)=-(v(425)*v(599))
dRdF(3,4)=-(v(426)*v(599))
dRdF(3,5)=-(v(427)*v(599))
dRdF(3,6)=-(v(428)*v(599))
dRdF(3,7)=-(v(429)*v(599))
dRdF(3,8)=-(v(430)*v(599))
dRdF(3,9)=-(v(431)*v(599))
dRdF(4,1)=-(v(432)*v(599))
dRdF(4,2)=-(v(433)*v(599))
dRdF(4,3)=-(v(434)*v(599))
dRdF(4,4)=-(v(435)*v(599))
dRdF(4,5)=-(v(436)*v(599))
dRdF(4,6)=-(v(437)*v(599))
dRdF(4,7)=-(v(438)*v(599))
dRdF(4,8)=-(v(439)*v(599))
dRdF(4,9)=-(v(440)*v(599))
dRdF(5,1)=v(450)
dRdF(5,2)=v(451)
dRdF(5,3)=v(452)
dRdF(5,4)=v(453)
dRdF(5,5)=v(454)
dRdF(5,6)=v(455)
dRdF(5,7)=v(456)
dRdF(5,8)=v(457)
dRdF(5,9)=v(458)
dRdF(6,1)=v(468)
dRdF(6,2)=v(469)
dRdF(6,3)=v(470)
dRdF(6,4)=v(471)
dRdF(6,5)=v(472)
dRdF(6,6)=v(473)
dRdF(6,7)=v(474)
dRdF(6,8)=v(475)
dRdF(6,9)=v(476)
dRdF(7,1)=v(523)
dRdF(7,2)=v(524)
dRdF(7,3)=v(525)
dRdF(7,4)=v(526)
dRdF(7,5)=v(527)
dRdF(7,6)=v(528)
dRdF(7,7)=v(529)
dRdF(7,8)=v(530)
dRdF(7,9)=v(531)
dRdF(8,1)=v(523)
dRdF(8,2)=v(524)
dRdF(8,3)=v(525)
dRdF(8,4)=v(526)
dRdF(8,5)=v(527)
dRdF(8,6)=v(528)
dRdF(8,7)=v(529)
dRdF(8,8)=v(530)
dRdF(8,9)=v(531)
dRdF(9,1)=v(450)
dRdF(9,2)=v(451)
dRdF(9,3)=v(452)
dRdF(9,4)=v(453)
dRdF(9,5)=v(454)
dRdF(9,6)=v(455)
dRdF(9,7)=v(456)
dRdF(9,8)=v(457)
dRdF(9,9)=v(458)
dRdF(10,1)=v(468)
dRdF(10,2)=v(469)
dRdF(10,3)=v(470)
dRdF(10,4)=v(471)
dRdF(10,5)=v(472)
dRdF(10,6)=v(473)
dRdF(10,7)=v(474)
dRdF(10,8)=v(475)
dRdF(10,9)=v(476)
dRdF(11,1)=-(v(599)*(v(133)*v(487)+v(414)*v(682)))
dRdF(11,2)=-(v(599)*(v(133)*v(488)+v(415)*v(682)))
dRdF(11,3)=-(v(599)*(v(133)*v(489)+v(416)*v(682)))
dRdF(11,4)=-(v(599)*(v(133)*v(490)+v(417)*v(682)))
dRdF(11,5)=-(v(599)*(v(133)*v(491)+v(418)*v(682)))
dRdF(11,6)=-(v(599)*(v(133)*v(492)+v(419)*v(682)))
dRdF(11,7)=-(v(599)*(v(133)*v(493)+v(420)*v(682)))
dRdF(11,8)=-(v(599)*(v(133)*v(494)+v(421)*v(682)))
dRdF(11,9)=-(v(599)*(v(133)*v(495)+v(422)*v(682)))
dRdF(12,1)=-(v(599)*(v(136)*v(487)+v(423)*v(682)))
dRdF(12,2)=-(v(599)*(v(136)*v(488)+v(424)*v(682)))
dRdF(12,3)=-(v(599)*(v(136)*v(489)+v(425)*v(682)))
dRdF(12,4)=-(v(599)*(v(136)*v(490)+v(426)*v(682)))
dRdF(12,5)=-(v(599)*(v(136)*v(491)+v(427)*v(682)))
dRdF(12,6)=-(v(599)*(v(136)*v(492)+v(428)*v(682)))
dRdF(12,7)=-(v(599)*(v(136)*v(493)+v(429)*v(682)))
dRdF(12,8)=-(v(599)*(v(136)*v(494)+v(430)*v(682)))
dRdF(12,9)=-(v(599)*(v(136)*v(495)+v(431)*v(682)))
dRdF(13,1)=-(v(599)*(v(138)*v(487)+v(432)*v(682)))
dRdF(13,2)=-(v(599)*(v(138)*v(488)+v(433)*v(682)))
dRdF(13,3)=-(v(599)*(v(138)*v(489)+v(434)*v(682)))
dRdF(13,4)=-(v(599)*(v(138)*v(490)+v(435)*v(682)))
dRdF(13,5)=-(v(599)*(v(138)*v(491)+v(436)*v(682)))
dRdF(13,6)=-(v(599)*(v(138)*v(492)+v(437)*v(682)))
dRdF(13,7)=-(v(599)*(v(138)*v(493)+v(438)*v(682)))
dRdF(13,8)=-(v(599)*(v(138)*v(494)+v(439)*v(682)))
dRdF(13,9)=-(v(599)*(v(138)*v(495)+v(440)*v(682)))
dRdF(14,1)=v(505)
dRdF(14,2)=v(506)
dRdF(14,3)=v(507)
dRdF(14,4)=v(508)
dRdF(14,5)=v(509)
dRdF(14,6)=v(510)
dRdF(14,7)=v(511)
dRdF(14,8)=v(512)
dRdF(14,9)=v(513)
dRdF(15,1)=v(496)
dRdF(15,2)=v(497)
dRdF(15,3)=v(498)
dRdF(15,4)=v(499)
dRdF(15,5)=v(500)
dRdF(15,6)=v(501)
dRdF(15,7)=v(502)
dRdF(15,8)=v(503)
dRdF(15,9)=v(504)
dRdF(16,1)=v(514)
dRdF(16,2)=v(515)
dRdF(16,3)=v(516)
dRdF(16,4)=v(517)
dRdF(16,5)=v(518)
dRdF(16,6)=v(519)
dRdF(16,7)=v(520)
dRdF(16,8)=v(521)
dRdF(16,9)=v(522)
dRdF(17,1)=v(514)
dRdF(17,2)=v(515)
dRdF(17,3)=v(516)
dRdF(17,4)=v(517)
dRdF(17,5)=v(518)
dRdF(17,6)=v(519)
dRdF(17,7)=v(520)
dRdF(17,8)=v(521)
dRdF(17,9)=v(522)
dRdF(18,1)=v(505)
dRdF(18,2)=v(506)
dRdF(18,3)=v(507)
dRdF(18,4)=v(508)
dRdF(18,5)=v(509)
dRdF(18,6)=v(510)
dRdF(18,7)=v(511)
dRdF(18,8)=v(512)
dRdF(18,9)=v(513)
dRdF(19,1)=v(496)
dRdF(19,2)=v(497)
dRdF(19,3)=v(498)
dRdF(19,4)=v(499)
dRdF(19,5)=v(500)
dRdF(19,6)=v(501)
dRdF(19,7)=v(502)
dRdF(19,8)=v(503)
dRdF(19,9)=v(504)
END
|
module DAMMmodel
include("DAMM.jl")
export DAMM
end
|
{-# OPTIONS --cubical --no-import-sorts --safe --postfix-projections #-}
module Cubical.Data.FinSet.Binary.Large where
open import Cubical.Functions.Embedding
open import Cubical.Functions.Involution
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Univalence
open import Cubical.Data.Bool
open import Cubical.Data.Sigma
open import Cubical.HITs.PropositionalTruncation
private
variable
ℓ : Level
isBinary : Type ℓ → Type ℓ
isBinary B = ∥ Bool ≃ B ∥
Binary : ∀ ℓ → Type _
Binary ℓ = Σ (Type ℓ) isBinary
isBinary→isSet : ∀{B : Type ℓ} → isBinary B → isSet B
isBinary→isSet {B} = rec isPropIsSet λ eqv → isOfHLevelRespectEquiv 2 eqv isSetBool
private
Σ≡Prop²
: ∀{ℓ ℓ'} {A : Type ℓ} {B : A → Type ℓ'}
→ {w x : Σ A B}
→ isOfHLevelDep 1 B
→ (p q : w ≡ x)
→ cong fst p ≡ cong fst q
→ p ≡ q
Σ≡Prop² _ _ _ r i j .fst = r i j
Σ≡Prop² {B = B} {w} {x} Bprp p q r i j .snd
= isPropDep→isSetDep Bprp (w .snd) (x .snd) (cong snd p) (cong snd q) r i j
BinaryEmbedding : isEmbedding (λ(B : Binary ℓ) → map-snd isBinary→isSet B)
BinaryEmbedding w x = isoToIsEquiv theIso
where
open Iso
f = map-snd isBinary→isSet
theIso : Iso (w ≡ x) (f w ≡ f x)
theIso .fun = cong f
theIso .inv p i .fst = p i .fst
theIso .inv p i .snd
= ∥∥-isPropDep (Bool ≃_) (w .snd) (x .snd) (λ i → p i .fst) i
theIso .rightInv p
= Σ≡Prop² (isOfHLevel→isOfHLevelDep 1 (λ _ → isPropIsSet)) _ p refl
theIso .leftInv p
= Σ≡Prop² (∥∥-isPropDep (Bool ≃_)) _ p refl
Base : Binary _
Base .fst = Bool
Base .snd = ∣ idEquiv Bool ∣
Loop : Base ≡ Base
Loop i .fst = notEq i
Loop i .snd = ∥∥-isPropDep (Bool ≃_) (Base .snd) (Base .snd) notEq i
private
notEq² : Square notEq refl refl notEq
notEq² = involPath² {f = not} notnot
Loop² : Square Loop refl refl Loop
Loop² i j .fst = notEq² i j
Loop² i j .snd
= isPropDep→isSetDep' (∥∥-isPropDep (Bool ≃_))
notEq² (cong snd Loop) refl refl (cong snd Loop) i j
isGroupoidBinary : isGroupoid (Binary ℓ)
isGroupoidBinary
= Embedding-into-hLevel→hLevel 2
(map-snd isBinary→isSet , BinaryEmbedding)
(isOfHLevelTypeOfHLevel 2)
record BinStructure (B : Type ℓ) : Type ℓ where
field
base : B
loop : base ≡ base
loop² : Square loop refl refl loop
trunc : isGroupoid B
structure₀ : BinStructure (Binary ℓ-zero)
structure₀ .BinStructure.base = Base
structure₀ .BinStructure.loop = Loop
structure₀ .BinStructure.loop² = Loop²
structure₀ .BinStructure.trunc = isGroupoidBinary
module Parameterized (B : Type ℓ) where
Baseᴾ : Bool ≃ B → Binary ℓ
Baseᴾ P = B , ∣ P ∣
Loopᴾ : (P Q : Bool ≃ B) → Baseᴾ P ≡ Baseᴾ Q
Loopᴾ P Q i = λ where
.fst → ua first i
.snd → ∥∥-isPropDep (Bool ≃_) ∣ P ∣ ∣ Q ∣ (ua first) i
where
first : B ≃ B
first = compEquiv (invEquiv P) Q
Loopᴾ² : (P Q R : Bool ≃ B) → Square (Loopᴾ P Q) (Loopᴾ P R) refl (Loopᴾ Q R)
Loopᴾ² P Q R i = Σ≡Prop (λ _ → squash) (S i)
where
PQ : B ≃ B
PQ = compEquiv (invEquiv P) Q
PR : B ≃ B
PR = compEquiv (invEquiv P) R
QR : B ≃ B
QR = compEquiv (invEquiv Q) R
Q-Q : Bool ≃ Bool
Q-Q = compEquiv Q (invEquiv Q)
PQRE : compEquiv PQ QR ≡ PR
PQRE = compEquiv PQ QR
≡[ i ]⟨ compEquiv-assoc (invEquiv P) Q QR (~ i) ⟩
compEquiv (invEquiv P) (compEquiv Q QR)
≡[ i ]⟨ compEquiv (invEquiv P) (compEquiv-assoc Q (invEquiv Q) R i) ⟩
compEquiv (invEquiv P) (compEquiv Q-Q R)
≡[ i ]⟨ compEquiv (invEquiv P) (compEquiv (invEquiv-is-rinv Q i) R) ⟩
compEquiv (invEquiv P) (compEquiv (idEquiv _) R)
≡[ i ]⟨ compEquiv (invEquiv P) (compEquivIdEquiv R i) ⟩
PR ∎
PQR : ua PQ ∙ ua QR ≡ ua PR
PQR = ua PQ ∙ ua QR
≡[ i ]⟨ uaCompEquiv PQ QR (~ i) ⟩
ua (compEquiv PQ QR)
≡⟨ cong ua PQRE ⟩
ua PR ∎
S : Square (ua PQ) (ua PR) refl (ua QR)
S i j
= hcomp (λ k → λ where
(j = i0) → B
(i = i0) → compPath-filler (ua PQ) (ua QR) (~ k) j
(i = i1) → ua PR j
(j = i1) → ua QR (i ∨ ~ k))
(PQR i j)
|
# This implements the common parts of Evolutionary Programming, i.e. the
# population-based "culling" between generations. Different variants of EP
# can then be implemented by changing the mutation-operator etc.
PopulationBasedEvolutionaryProgrammingDefaultParameters = {
:PopulationSize => 50,
:InitialStandardDeviation => 3.0, # Initial standard deviation
}
# The specific functions of a particular EP strategy is attached to a strategy
# datum while the generic population-based EP is kept in a single type. This
# way we can easily change the strategy without having to rewrite the common parts
# throughout.
abstract EvolutionaryProgrammingStrategy
type PopulationBasedEvolutionaryProgramming <: PopulationOptimizer
parameters::Parameters
generation::Int64
dimension::Int64
population_size::Int64
# Pre-calc the tau values so we do not have to recalc it again and again during evolution.
tau::Float64
tauprim::Float64
# Two populations that we switch between as being the current population.
# The generation mod(number, 2) determines which one is current. This way
# we can avoid continues memory allocation and freeing of the population
# structures.
pop0::Array{Float64, 2}
pop1::Array{Float64, 2}
# Child population used in creating the next population
children::Array{Float64, 2}
# And the sigma values for each individual are kept in their separate matrices.
# Exact same structure as for the populations and children matrices.
sigmas0::Array{Float64, 2}
sigmas1::Array{Float64, 2}
childsigmas::Array{Float64, 2}
PopulationBasedEvolutionaryProgramming(parameters) = begin
dim = parameters[:NumDimensions]
popsize = parameters[:PopulationSize]
initial_population = rand_individuals_lhs(parameters[:SearchSpace], popsize)
initial_sigmas = parameters[:InitialStandardDeviation] * ones(dims, popsize)
new(parameters, 0, dims, popsize,
1.0 / sqrt(2 * sqrt(popsize)), 1.0 / sqrt(2 * popsize),
initial_population, zeros(Float64, dims, popsize), zeros(Float64, dims, popsize),
initial_sigmas, zeros(Float64, dims, popsize), zeros(Float64, dims, popsize))
end
end
function get_current_population(pep::PopulationBasedEvolutionaryProgramming)
if mod(pep.generation, 2) == 0
return pep.pop0, pep.sigmas0
else
return pep.pop1, pep.sigmas1
end
end
# The generic EP strategy functions have the abstract type and thus specific
# strategies can fall back on them simply by not "overriding" that function.
# This implements a classic Gaussian EP with gaussian mutations (GEP).
has_ask_tell_interface(ep::EvolutionaryProgrammingStrategy) = false
function step(ep::EvolutionaryProgrammingStrategy)
pep = ep.pep
children = pep.children
childsigmas = pep.childsigmas
currentpop, currentsigmas, nextpop, nextsigmas = get_current_and_next_population_and_sigma(pep)
# Mutate each parent to create a child.
for i in 1:pep.population_size
children[:,i], childsigmas[:,i] = mutate_individual(ep, currentpop, currentsigmas,
i, pep.dimension, pep.tauprim, pep.tau)
end
# Select the individuals to survive and copy them to the next population.
select_winning_individuals(ep, currentpop, currentsigmas, children, childsigmas, nextpop, nextsigmas)
end
function select_winning_individuals(ep::EvolutionaryProgrammingStrategy,
currentpop::Array{Float64, 2}, currentsigmas::Array{Float64, 2},
children::Array{Float64, 2}, childsigmas::Array{Float64, 2},
nextpop::Array{Float64, 2}, nextsigmas::Array{Float64, 2})
end
function mutate_individual(ep::EvolutionaryProgrammingStrategy,
population::Array{Float64, 2}, sigmas::Array{Float64, 2},
i::Int64, dims::Int64, tauprim::Float64, tau::Float64)
tauprimconst = tauprim * sample_tauprimconst_distribution(ep)
childsigmas = sigmas[:,i] .* exp( tauprimconst + tau * sample_sigma_distribution(ep, dims)' )
child = population[:,i] .+ childsigmas .* sample_mutation_distribution(ep, dims)'
return child, childsigmas
end
function sample_tauprimconst_distribution(ep::EvolutionaryProgrammingStrategy)
randn() # Standard is to use a N(0, 1) gaussian...
end
# The standard distribution is a Gaussian(0, 1)
function sample_mutation_distribution(ep::EvolutionaryProgrammingStrategy, numsamples::Int64)
randn(numsamples) # Standard is to use a N(0, 1) gaussians...
end
# The standard distribution for mutating the sigmas is a Gaussian(0, 1) for each dimension.
function sample_sigma_distribution(ep::EvolutionaryProgrammingStrategy, numsamples::Int64)
randn(numsamples) # Standard is to use a N(0, 1) gaussians...
end
# Specific EP variants are implemented in their own types and have the PBEP
# structure in them
type GaussianEvolutionaryProgramming <: EvolutionaryProgrammingStrategy
pep::PopulationBasedEvolutionaryProgramming
end
|
State Before: ι : Type ?u.45050
α : Type u_1
β : Type ?u.45056
π : ι → Type ?u.45061
inst✝ : GeneralizedHeytingAlgebra α
a b c d : α
⊢ a ⇨ b ⇔ c = (a ⊓ c ⇨ b) ⊓ (a ⊓ b ⇨ c) State After: no goals Tactic: rw [bihimp, himp_inf_distrib, himp_himp, himp_himp]
|
= = = = 2008 = = = =
|
# Copyright 2021 The FirstOrderLp Authors
#
# 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.
"""
Parameters of the Malitsky and Pock lineseach algorithm
(https://arxiv.org/pdf/1608.08883.pdf).
"""
struct MalitskyPockStepsizeParameters
"""
Factor by which the step size is multiplied for in the inner loop.
Valid values: interval (0, 1). Corresponds to mu in the paper.
"""
downscaling_factor::Float64
# Y. Malitsky notes that while the theory requires the value to be strictly
# less than 1, a value of 1 should work fine in practice.
"""
Breaking factor that defines the stopping criteria of the linesearch.
Valid values: interval (0, 1]. Corresponds to delta in the paper.
"""
breaking_factor::Float64
"""
Interpolation coefficient to pick next step size. The next step size can be
picked within an interval [a, b] (See Step 2 of Algorithm 1). The solver uses
a + interpolation_coefficient * (b - a). Valid values: interval [0, 1].
"""
interpolation_coefficient::Float64
end
"""
Parameters used for the adaptive stepsize policy.
At each inner iteration we update the step size as follows
Our step sizes are a factor
1 - (iteration + 1)^(-reduction_exponent)
smaller than they could be as a margin to reduce rejected steps.
From the first term when we have to reject a step, the step_size
decreases by a factor of at least 1 - (iteration + 1)^(-reduction_exponent).
From the second term we increase the step_size by a factor of at most
1 + (iteration + 1)^(-growth_exponent)
Therefore if more than order
(iteration + 1)^(reduction_exponent - growth_exponent)
fraction of the iterations have a rejected step we overall decrease the
step_size. When the step_size is below the inverse of the max singular
value we stop having rejected steps.
"""
struct AdaptiveStepsizeParams
reduction_exponent::Float64
growth_exponent::Float64
end
"""
Empty placeholder for the parameters of a constant step size policy.
"""
struct ConstantStepsizeParams end
"""
A PdhgParameters struct specifies the parameters for solving the saddle
point formulation of an problem using primal-dual hybrid gradient.
Quadratic Programming Problem (see quadratic_programming.jl):
minimize 1/2 * x' * objective_matrix * x + objective_vector' * x
+ objective_constant
s.t. constraint_matrix[1:num_equalities, :] * x =
right_hand_side[1:num_equalities]
constraint_matrix[(num_equalities + 1):end, :] * x >=
right_hand_side[(num_equalities + 1):end, :]
variable_lower_bound <= x <= variable_upper_bound
We use notation from Chambolle and Pock, "On the ergodic convergence rates of a
first-order primal-dual algorithm"
(http://www.optimization-online.org/DB_FILE/2014/09/4532.pdf).
That paper doesn't explicitly use the terminology "primal-dual hybrid gradient"
but their Theorem 1 is analyzing PDHG. In this file "Theorem 1" without further
reference refers to that paper.
Our problem is equivalent to the saddle point problem:
min_x max_y L(x, y)
where
L(x, y) = y' K x + f(x) + g(x) - h*(y)
K = -constraint_matrix
f(x) = objective_constant + objective_vector' x + 1/2*x' objective_matrix x
g(x) = 0 if variable_lower_bound <= x <= variable_upper_bound
otherwise infinity
h*(y) = -right_hand_side' y if y[(num_equalities + 1):end] >= 0
otherwise infinity
Note that the places where g(x) and h*(y) are infinite effectively limits the
domain of the min and max. Therefore there's no infinity in the code.
The code uses slightly different notation from the Chambolle and Pock paper.
The primal and dual step sizes are parameterized as:
tau = primal_step_size = step_size / primal_weight
sigma = dual_step_size = step_size * primal_weight.
The primal_weight factor is named as such because this parameterization is
equivalent to defining the Bregman divergences as:
D_x(x, x bar) = 0.5 * primal_weight ||x - x bar||_2^2, and
D_y(y, y bar) = 0.5 / primal_weight ||y - y bar||_2^2.
The parameter primal_weight is adjusted smoothly at each restart; to balance the
primal and dual distances traveled since the last restart; see
compute_new_primal_weight().
The adaptive rule adjusts step_size to be as large as possible without
violating the condition assumed in Theorem 1. Adjusting the step size
unfortunately seems to invalidate that Theorem (unlike the case of mirror prox)
but this step size adjustment heuristic seems to work fine in practice.
See comments in the code for details.
TODO: compare the above step size scheme with the scheme by Goldstein
et al (https://arxiv.org/pdf/1305.0546.pdf).
TODO: explore PDHG variants with tuning parameters, e.g. the
overrelaxed and intertial variants in Chambolle and Pock and the algorithm in
"An Algorithmic Framework of Generalized Primal-Dual Hybrid Gradient Methods for
Saddle Point Problems" by Bingsheng He, Feng Ma, Xiaoming Yuan
(http://www.optimization-online.org/DB_FILE/2016/02/5315.pdf).
"""
struct PdhgParameters
"""
Number of L_infinity Ruiz rescaling iterations to apply to the constraint
matrix. Zero disables this rescaling pass.
"""
l_inf_ruiz_iterations::Int
"""
If true, applies L2 norm rescaling after the Ruiz rescaling.
"""
l2_norm_rescaling::Bool
"""
If not `nothing`, runs Pock-Chambolle rescaling with the given alpha exponent
parameter.
"""
pock_chambolle_alpha::Union{Float64,Nothing}
"""
Used to bias the initial value of the primal/dual balancing parameter
primal_weight. Must be positive. See also
scale_invariant_initial_primal_weight.
"""
primal_importance::Float64
"""
If true, computes the initial primal weight with a scale-invariant formula
biased by primal_importance; see select_initial_primal_weight() for more
details. If false, primal_importance itself is used as the initial primal
weight.
"""
scale_invariant_initial_primal_weight::Bool
"""
If >= 4 a line of debugging info is printed during some iterations. If >= 2
some info is printed about the final solution.
"""
verbosity::Int64
"""
Whether to record an IterationStats object.
"""
record_iteration_stats::Bool
"""
Check for termination with this frequency (in iterations).
"""
termination_evaluation_frequency::Int32
"""
The termination criteria for the algorithm.
"""
termination_criteria::TerminationCriteria
"""
Parameters that control when the algorithm restarts and whether it resets
to the average or the current iterate. Also, controls the primal weight
updates.
"""
restart_params::RestartParameters
"""
Parameters of the step size policy. There are three step size policies
implemented: Adaptive, Malitsky and Pock, and constant step size.
"""
step_size_policy_params::Union{
MalitskyPockStepsizeParameters,
AdaptiveStepsizeParams,
ConstantStepsizeParams,
}
end
"""
A PdhgSolverState struct specifies the state of the solver. It is used to
pass information among the main solver function and other helper functions.
"""
mutable struct PdhgSolverState
current_primal_solution::Vector{Float64}
current_dual_solution::Vector{Float64}
"""
Current primal delta. That is current_primal_solution - previous_primal_solution.
"""
delta_primal::Vector{Float64}
"""
Current dual delta. That is current_dual_solution - previous_dual_solution.
"""
delta_dual::Vector{Float64}
"""
A cache of constraint_matrix' * current_dual_solution.
"""
current_dual_product::Vector{Float64}
solution_weighted_avg::SolutionWeightedAverage
step_size::Float64
primal_weight::Float64
"""
True only if the solver was unable to take a step in the previous
iterations because of numerical issues, and must terminate on the next step.
"""
numerical_error::Bool
"""
Number of KKT passes so far.
"""
cumulative_kkt_passes::Float64
"""
Total number of iterations. This includes inner iterations.
"""
total_number_iterations::Int64
"""
Latest required_ratio. This field is only used with the adaptive step size.
The proof of Theorem 1 requires 1 >= required_ratio.
"""
required_ratio::Union{Float64,Nothing}
"""
Ratio between the last two step sizes: step_size(n)/step_size(n-1).
It is only saved while using Malitsky and Pock linesearch.
"""
ratio_step_sizes::Union{Float64,Nothing}
end
"""
Defines the primal norm and dual norm using the norms of matrices, step_size
and primal_weight. This is used only for interacting with general utilities
in saddle_point.jl. PDHG utilities these norms implicitly.
"""
function define_norms(
primal_size::Int64,
dual_size::Int64,
step_size::Float64,
primal_weight::Float64,
)
# TODO: Should these norms include the step size?
primal_norm_params = 1 / step_size * primal_weight * ones(primal_size)
dual_norm_params = 1 / step_size / primal_weight * ones(dual_size)
return primal_norm_params, dual_norm_params
end
"""
Logging while the algorithm is running.
"""
function pdhg_specific_log(
problem::QuadraticProgrammingProblem,
iteration::Int64,
current_primal_solution::Vector{Float64},
current_dual_solution::Vector{Float64},
step_size::Float64,
required_ratio::Union{Float64,Nothing},
primal_weight::Float64,
)
Printf.@printf(
" %5d norms=(%9g, %9g) inv_step_size=%9g ",
iteration,
norm(current_primal_solution),
norm(current_dual_solution),
1 / step_size,
)
if !isnothing(required_ratio)
Printf.@printf(
" primal_weight=%18g dual_obj=%18g inverse_ss=%18g\n",
primal_weight,
corrected_dual_obj(
problem,
current_primal_solution,
current_dual_solution,
),
required_ratio
)
else
Printf.@printf(
" primal_weight=%18g dual_obj=%18g\n",
primal_weight,
corrected_dual_obj(
problem,
current_primal_solution,
current_dual_solution,
)
)
end
end
"""
Logging for when the algorithm terminates.
"""
function pdhg_final_log(
problem::QuadraticProgrammingProblem,
avg_primal_solution::Vector{Float64},
avg_dual_solution::Vector{Float64},
verbosity::Int64,
iteration::Int64,
termination_reason::TerminationReason,
last_iteration_stats::IterationStats,
)
if verbosity >= 2
infeas = max_primal_violation(problem, avg_primal_solution)
primal_obj_val = primal_obj(problem, avg_primal_solution)
dual_stats =
compute_dual_stats(problem, avg_primal_solution, avg_dual_solution)
println("Avg solution:")
Printf.@printf(
" pr_infeas=%12g pr_obj=%15.10g dual_infeas=%12g dual_obj=%15.10g\n",
infeas,
primal_obj_val,
norm(dual_stats.dual_residual, Inf),
dual_stats.dual_objective
)
Printf.@printf(
" primal norms: L1=%15.10g, L2=%15.10g, Linf=%15.10g\n",
norm(avg_primal_solution, 1),
norm(avg_primal_solution),
norm(avg_primal_solution, Inf)
)
Printf.@printf(
" dual norms: L1=%15.10g, L2=%15.10g, Linf=%15.10g\n",
norm(avg_dual_solution, 1),
norm(avg_dual_solution),
norm(avg_dual_solution, Inf)
)
end
generic_final_log(
problem,
avg_primal_solution,
avg_dual_solution,
last_iteration_stats,
verbosity,
iteration,
termination_reason,
)
end
"""
Estimate the probability that the power method, after k iterations, has relative
error > epsilon. This is based on Theorem 4.1(a) (on page 13) from
"Estimating the Largest Eigenvalue by the Power and Lanczos Algorithms with a
Random Start"
https://pdfs.semanticscholar.org/2b2e/a941e55e5fa2ee9d8f4ff393c14482051143.pdf
"""
function power_method_failure_probability(
dimension::Int64,
epsilon::Float64,
k::Int64,
)
if k < 2 || epsilon <= 0.0
# The theorem requires epsilon > 0 and k >= 2.
return 1.0
end
return min(0.824, 0.354 / (epsilon * (k - 1))) *
sqrt(dimension) *
(1.0 - epsilon)^(k - 1 / 2)
end
"""
Estimate the maximum singular value using power method
https://en.wikipedia.org/wiki/Power_iteration, returning a result with
desired_relative_error with probability at least 1 - probability_of_failure.
Note that this will take approximately log(n / delta^2)/(2 * epsilon) iterations
as per the discussion at the bottom of page 15 of
"Estimating the Largest Eigenvalue by the Power and Lanczos Algorithms with a
Random Start"
https://pdfs.semanticscholar.org/2b2e/a941e55e5fa2ee9d8f4ff393c14482051143.pdf
For lighter reading on this topic see
https://courses.cs.washington.edu/courses/cse521/16sp/521-lecture-13.pdf
which does not include the failure probability.
# Output
A tuple containing:
- estimate of the maximum singular value
- the number of power iterations required to compute it
"""
function estimate_maximum_singular_value(
matrix::SparseMatrixCSC{Float64,Int64};
probability_of_failure = 0.01::Float64,
desired_relative_error = 0.1::Float64,
seed::Int64 = 1,
)
# Epsilon is the relative error on the eigenvalue of matrix' * matrix.
epsilon = 1.0 - (1.0 - desired_relative_error)^2
# Use the power method on matrix' * matrix
x = randn(Random.MersenneTwister(seed), size(matrix, 2))
number_of_power_iterations = 0
while power_method_failure_probability(
size(matrix, 2),
epsilon,
number_of_power_iterations,
) > probability_of_failure
x = x / norm(x, 2)
x = matrix' * (matrix * x)
number_of_power_iterations += 1
end
# The singular value is the square root of the maximum eigenvalue of
# matrix' * matrix
return sqrt(dot(x, matrix' * (matrix * x)) / norm(x, 2)^2),
number_of_power_iterations
end
function compute_next_primal_solution(
problem::QuadraticProgrammingProblem,
current_primal_solution::Vector{Float64},
current_dual_product::Vector{Float64},
step_size::Float64,
primal_weight::Float64,
)
# The next lines compute the primal portion of the PDHG algorithm:
# argmin_x [gradient(f)(current_primal_solution)'x + g(x)
# + current_dual_solution' K x
# + (1 / step_size) * D_x(x, current_primal_solution)]
# See Sections 2-3 of Chambolle and Pock and the comment above
# PdhgParameters.
# This minimization is easy to do in closed form since it can be separated
# into independent problems for each of the primal variables. The
# projection onto the primal feasibility set comes from the closed form
# for the above minimization and the cases where g(x) is infinite - there
# isn't officially any projection step in the algorithm.
primal_gradient = compute_primal_gradient_from_dual_product(
problem,
current_primal_solution,
current_dual_product,
)
next_primal =
current_primal_solution .- (step_size / primal_weight) .* primal_gradient
project_primal!(next_primal, problem)
return next_primal
end
function compute_next_dual_solution(
problem::QuadraticProgrammingProblem,
current_primal_solution::Vector{Float64},
next_primal::Vector{Float64},
current_dual_solution::Vector{Float64},
step_size::Float64,
primal_weight::Float64;
extrapolation_coefficient::Float64 = 1.0,
)
# The next two lines compute the dual portion:
# argmin_y [H*(y) - y' K (next_primal + extrapolation_coefficient*(next_primal - current_primal_solution)
# + 0.5*norm_Y(y-current_dual_solution)^2]
dual_gradient = compute_dual_gradient(
problem,
next_primal .+
extrapolation_coefficient .* (next_primal - current_primal_solution),
)
next_dual =
current_dual_solution .+ (primal_weight * step_size) .* dual_gradient
project_dual!(next_dual, problem)
next_dual_product = problem.constraint_matrix' * next_dual
return next_dual, next_dual_product
end
"""
Updates the solution fields of the solver state with the arguments given.
The function modifies the first argument: solver_state.
"""
function update_solution_in_solver_state(
solver_state::PdhgSolverState,
next_primal::Vector{Float64},
next_dual::Vector{Float64},
next_dual_product::Vector{Float64},
)
solver_state.delta_primal = next_primal - solver_state.current_primal_solution
solver_state.delta_dual = next_dual - solver_state.current_dual_solution
solver_state.current_primal_solution = next_primal
solver_state.current_dual_solution = next_dual
solver_state.current_dual_product = next_dual_product
weight = solver_state.step_size
add_to_solution_weighted_average(
solver_state.solution_weighted_avg,
solver_state.current_primal_solution,
solver_state.current_dual_solution,
weight,
)
end
"""
Computes the interaction and movement of the new iterates.
The movement is used to check if there is a numerical error (movement == 0.0)
and based on the theory (Theorem 1) the algorithm only moves if
interaction / movement <= step_size.
"""
function compute_interaction_and_movement(
solver_state::PdhgSolverState,
problem::QuadraticProgrammingProblem,
next_primal::Vector{Float64},
next_dual::Vector{Float64},
next_dual_product::Vector{Float64},
)
delta_primal = next_primal .- solver_state.current_primal_solution
delta_dual = next_dual .- solver_state.current_dual_solution
if iszero(problem.objective_matrix)
primal_objective_interaction = 0.0
else
primal_objective_interaction =
0.5 * (delta_primal' * problem.objective_matrix * delta_primal)
end
primal_dual_interaction =
delta_primal' * (next_dual_product .- solver_state.current_dual_product)
interaction = abs(primal_dual_interaction) + abs(primal_objective_interaction)
movement =
0.5 * solver_state.primal_weight * norm(delta_primal)^2 +
(0.5 / solver_state.primal_weight) * norm(delta_dual)^2
return interaction, movement
end
"""
Takes a step using Malitsky and Pock linesearch.
It modifies the third arguement: solver_state.
"""
function take_step(
step_params::MalitskyPockStepsizeParameters,
problem::QuadraticProgrammingProblem,
solver_state::PdhgSolverState,
)
if !is_linear_programming_problem(problem)
error(
"Malitsky and Pock linesearch is only supported for linear" *
" programming problems.",
)
end
step_size = solver_state.step_size
ratio_step_sizes = solver_state.ratio_step_sizes
done = false
iter = 0
next_primal = compute_next_primal_solution(
problem,
solver_state.current_primal_solution,
solver_state.current_dual_product,
step_size,
solver_state.primal_weight,
)
solver_state.cumulative_kkt_passes += 0.5
step_size =
step_size +
step_params.interpolation_coefficient *
(sqrt(1 + ratio_step_sizes) - 1) *
step_size
max_iter = 60
while !done && iter < max_iter
iter += 1
solver_state.total_number_iterations += 1
ratio_step_sizes = step_size / solver_state.step_size
# TODO: Get rid of the extra multiply by the constraint matrix (see Remark 1 in
# https://arxiv.org/pdf/1608.08883.pdf)
next_dual, next_dual_product = compute_next_dual_solution(
problem,
solver_state.current_primal_solution,
next_primal,
solver_state.current_dual_solution,
step_size,
solver_state.primal_weight;
extrapolation_coefficient = ratio_step_sizes,
)
delta_dual = next_dual .- solver_state.current_dual_solution
delta_dual_product = next_dual_product .- solver_state.current_dual_product
# This is the ideal count. The current version of the code incurs in 1.0 kkt
# pass. See TODO before the next_dual update above.
solver_state.cumulative_kkt_passes += 0.5
# The primal weight does not play a role in this condition. As noted in the
# paper (See second paragraph of Section 2 in https://arxiv.org/pdf/1608.08883.pdf)
# the coefficient on left-hand-side is equal to
# sqrt(<primal_step_size> * <dual_step_size>) = step_size.
# where the equality follows since the primal_weight in the primal and dual step
# sizes cancel out.
if step_size * norm(delta_dual_product) <=
step_params.breaking_factor * norm(delta_dual)
# Malitsky and Pock guarantee uses a nonsymmetric weighted average, the
# primal variable average involves the initial point, while the dual
# doesn't. See Theorem 2 in https://arxiv.org/pdf/1608.08883.pdf for
# details.
if solver_state.solution_weighted_avg.sum_primal_solutions_count == 0
add_to_primal_solution_weighted_average(
solver_state.solution_weighted_avg,
solver_state.current_primal_solution,
step_size * ratio_step_sizes,
)
end
update_solution_in_solver_state(
solver_state,
next_primal,
next_dual,
next_dual_product,
)
done = true
else
step_size *= step_params.downscaling_factor
end
end
if iter == max_iter && !done
solver_state.numerical_error = true
return
end
solver_state.step_size = step_size
solver_state.ratio_step_sizes = ratio_step_sizes
end
"""
Takes a step using the adaptive step size.
It modifies the third argument: solver_state.
"""
function take_step(
step_params::AdaptiveStepsizeParams,
problem::QuadraticProgrammingProblem,
solver_state::PdhgSolverState,
)
step_size = solver_state.step_size
done = false
iter = 0
while !done
iter += 1
solver_state.total_number_iterations += 1
next_primal = compute_next_primal_solution(
problem,
solver_state.current_primal_solution,
solver_state.current_dual_product,
step_size,
solver_state.primal_weight,
)
next_dual, next_dual_product = compute_next_dual_solution(
problem,
solver_state.current_primal_solution,
next_primal,
solver_state.current_dual_solution,
step_size,
solver_state.primal_weight,
)
interaction, movement = compute_interaction_and_movement(
solver_state,
problem,
next_primal,
next_dual,
next_dual_product,
)
solver_state.cumulative_kkt_passes += 1
if movement == 0.0
# The algorithm will terminate at the beginning of the next iteration
solver_state.numerical_error = true
break
end
# The proof of Theorem 1 requires movement / step_size >= interaction.
if interaction > 0
step_size_limit = movement / interaction
else
step_size_limit = Inf
end
if step_size <= step_size_limit
update_solution_in_solver_state(
solver_state,
next_primal,
next_dual,
next_dual_product,
)
done = true
end
first_term =
(
1 -
(
solver_state.total_number_iterations + 1
)^(-step_params.reduction_exponent)
) * step_size_limit
second_term =
(
1 +
(
solver_state.total_number_iterations + 1
)^(-step_params.growth_exponent)
) * step_size
step_size = min(first_term, second_term)
end
solver_state.step_size = step_size
end
"""
Takes a step with constant step size.
It modifies the third argument: solver_state.
"""
function take_step(
step_params::ConstantStepsizeParams,
problem::QuadraticProgrammingProblem,
solver_state::PdhgSolverState,
)
next_primal = compute_next_primal_solution(
problem,
solver_state.current_primal_solution,
solver_state.current_dual_product,
solver_state.step_size,
solver_state.primal_weight,
)
next_dual, next_dual_product = compute_next_dual_solution(
problem,
solver_state.current_primal_solution,
next_primal,
solver_state.current_dual_solution,
solver_state.step_size,
solver_state.primal_weight,
)
solver_state.cumulative_kkt_passes += 1
update_solution_in_solver_state(
solver_state,
next_primal,
next_dual,
next_dual_product,
)
end
"""
`optimize(params::PdhgParameters,
original_problem::QuadraticProgrammingProblem)`
Solves a quadratic program using primal-dual hybrid gradient.
# Arguments
- `params::PdhgParameters`: parameters.
- `original_problem::QuadraticProgrammingProblem`: the QP to solve.
# Returns
A SaddlePointOutput struct containing the solution found.
"""
function optimize(
params::PdhgParameters,
original_problem::QuadraticProgrammingProblem,
)
validate(original_problem)
qp_cache = cached_quadratic_program_info(original_problem)
scaled_problem = rescale_problem(
params.l_inf_ruiz_iterations,
params.l2_norm_rescaling,
params.pock_chambolle_alpha,
params.verbosity,
original_problem,
)
problem = scaled_problem.scaled_qp
primal_size = length(problem.variable_lower_bound)
dual_size = length(problem.right_hand_side)
if params.primal_importance <= 0 || !isfinite(params.primal_importance)
error("primal_importance must be positive and finite")
end
# TODO: Correctly account for the number of kkt passes in
# initialization
solver_state = PdhgSolverState(
zeros(primal_size), # current_primal_solution
zeros(dual_size), # current_dual_solution
zeros(primal_size), # delta_primal
zeros(dual_size), # delta_dual
zeros(primal_size), # current_dual_product
initialize_solution_weighted_average(primal_size, dual_size),
0.0, # step_size
1.0, # primal_weight
false, # numerical_error
0.0, # cumulative_kkt_passes
0, # total_number_iterations
nothing, # required_ratio
nothing, # ratio_step_sizes
)
if params.step_size_policy_params isa AdaptiveStepsizeParams
solver_state.cumulative_kkt_passes += 0.5
solver_state.step_size = 1.0 / norm(problem.constraint_matrix, Inf)
elseif params.step_size_policy_params isa MalitskyPockStepsizeParameters
solver_state.cumulative_kkt_passes += 0.5
solver_state.step_size = 1.0 / norm(problem.constraint_matrix, Inf)
solver_state.ratio_step_sizes = 1.0
else
desired_relative_error = 0.2
maximum_singular_value, number_of_power_iterations =
estimate_maximum_singular_value(
problem.constraint_matrix,
probability_of_failure = 0.001,
desired_relative_error = desired_relative_error,
)
solver_state.step_size =
(1 - desired_relative_error) / maximum_singular_value
solver_state.cumulative_kkt_passes += number_of_power_iterations
end
# Idealized number of KKT passes each time the termination criteria and
# restart scheme is run. One of these comes from evaluating the gradient at
# the average solution and evaluating the gradient at the current solution.
# In practice this number is four.
KKT_PASSES_PER_TERMINATION_EVALUATION = 2.0
if params.scale_invariant_initial_primal_weight
solver_state.primal_weight = select_initial_primal_weight(
problem,
ones(primal_size),
ones(dual_size),
params.primal_importance,
params.verbosity,
)
else
solver_state.primal_weight = params.primal_importance
end
primal_weight_update_smoothing =
params.restart_params.primal_weight_update_smoothing
iteration_stats = IterationStats[]
start_time = time()
# Basic algorithm refers to the primal and dual steps, and excludes restart
# schemes and termination evaluation.
time_spent_doing_basic_algorithm = 0.0
# This variable is used in the adaptive restart scheme.
last_restart_info = create_last_restart_info(
problem,
solver_state.current_primal_solution,
solver_state.current_dual_solution,
)
# For termination criteria:
termination_criteria = params.termination_criteria
iteration_limit = termination_criteria.iteration_limit
termination_evaluation_frequency = params.termination_evaluation_frequency
# This flag represents whether a numerical error occurred during the algorithm
# if it is set to true it will trigger the algorithm to terminate.
solver_state.numerical_error = false
display_iteration_stats_heading(params.verbosity)
iteration = 0
while true
iteration += 1
# Evaluate the iteration stats at frequency
# termination_evaluation_frequency, when the iteration_limit is reached,
# or if a numerical error occurs at the previous iteration.
if mod(iteration - 1, termination_evaluation_frequency) == 0 ||
iteration == iteration_limit + 1 ||
iteration <= 10 ||
solver_state.numerical_error
# TODO: Experiment with evaluating every power of two iterations.
# This ensures that we do sufficient primal weight updates in the initial
# stages of the algorithm.
solver_state.cumulative_kkt_passes +=
KKT_PASSES_PER_TERMINATION_EVALUATION
# Compute the average solution since the last restart point.
if solver_state.numerical_error ||
solver_state.solution_weighted_avg.sum_primal_solutions_count == 0 ||
solver_state.solution_weighted_avg.sum_dual_solutions_count == 0
avg_primal_solution = solver_state.current_primal_solution
avg_dual_solution = solver_state.current_dual_solution
else
avg_primal_solution, avg_dual_solution =
compute_average(solver_state.solution_weighted_avg)
end
current_iteration_stats = evaluate_unscaled_iteration_stats(
scaled_problem,
qp_cache,
params.termination_criteria,
params.record_iteration_stats,
avg_primal_solution,
avg_dual_solution,
iteration,
time() - start_time,
solver_state.cumulative_kkt_passes,
termination_criteria.eps_optimal_absolute,
termination_criteria.eps_optimal_relative,
solver_state.step_size,
solver_state.primal_weight,
POINT_TYPE_AVERAGE_ITERATE,
)
method_specific_stats = current_iteration_stats.method_specific_stats
method_specific_stats["time_spent_doing_basic_algorithm"] =
time_spent_doing_basic_algorithm
primal_norm_params, dual_norm_params = define_norms(
primal_size,
dual_size,
solver_state.step_size,
solver_state.primal_weight,
)
update_objective_bound_estimates(
current_iteration_stats.method_specific_stats,
problem,
avg_primal_solution,
avg_dual_solution,
primal_norm_params,
dual_norm_params,
)
if params.record_iteration_stats
push!(iteration_stats, current_iteration_stats)
end
# Check the termination criteria.
termination_reason = check_termination_criteria(
termination_criteria,
qp_cache,
current_iteration_stats,
)
if solver_state.numerical_error && termination_reason == false
termination_reason = TERMINATION_REASON_NUMERICAL_ERROR
end
# Print table.
if print_to_screen_this_iteration(
termination_reason,
iteration,
params.verbosity,
termination_evaluation_frequency,
)
display_iteration_stats(current_iteration_stats, params.verbosity)
end
if termination_reason != false
# ** Terminate the algorithm **
# This is the only place the algorithm can terminate. Please keep it
# this way.
pdhg_final_log(
problem,
avg_primal_solution,
avg_dual_solution,
params.verbosity,
iteration,
termination_reason,
current_iteration_stats,
)
return unscaled_saddle_point_output(
scaled_problem,
avg_primal_solution,
avg_dual_solution,
termination_reason,
iteration - 1,
iteration_stats,
)
end
current_iteration_stats.restart_used = run_restart_scheme(
problem,
solver_state.solution_weighted_avg,
solver_state.current_primal_solution,
solver_state.current_dual_solution,
last_restart_info,
iteration - 1,
primal_norm_params,
dual_norm_params,
solver_state.primal_weight,
params.verbosity,
params.restart_params,
)
if current_iteration_stats.restart_used != RESTART_CHOICE_NO_RESTART
solver_state.primal_weight = compute_new_primal_weight(
last_restart_info,
solver_state.primal_weight,
primal_weight_update_smoothing,
params.verbosity,
)
solver_state.ratio_step_sizes = 1.0
end
if current_iteration_stats.restart_used ==
RESTART_CHOICE_RESTART_TO_AVERAGE
solver_state.current_dual_product =
problem.constraint_matrix' * solver_state.current_dual_solution
end
end
time_spent_doing_basic_algorithm_checkpoint = time()
if params.verbosity >= 6 && print_to_screen_this_iteration(
false, # termination_reason
iteration,
params.verbosity,
termination_evaluation_frequency,
)
pdhg_specific_log(
problem,
iteration,
solver_state.current_primal_solution,
solver_state.current_dual_solution,
solver_state.step_size,
solver_state.required_ratio,
solver_state.primal_weight,
)
end
take_step(params.step_size_policy_params, problem, solver_state)
time_spent_doing_basic_algorithm +=
time() - time_spent_doing_basic_algorithm_checkpoint
end
end
|
// Copyright PA Knowledge Ltd 2021
// MIT License. For licence terms see LICENCE.md file.
#ifndef ENTERPRISEDIODEFILETRANSFER_STANDARDPACKETGENERATOR_HPP
#define ENTERPRISEDIODEFILETRANSFER_STANDARDPACKETGENERATOR_HPP
#include "PacketGeneratorInterface.hpp"
#include "UdpClientInterface.hpp"
#include "enterprisediode/EnterpriseDiodeHeader.hpp"
#include <boost/asio/buffer.hpp>
#include <optional>
class StandardPacketGenerator: public PacketGeneratorInterface
{
public:
StandardPacketGenerator(std::optional<std::uint32_t> repeatPacketCount, const std::string& filename);
void setSessionID(std::uint32_t newId) override;
[[nodiscard]] std::optional<ConstSocketBuffers> next(std::istream& inputStream, std::uint32_t sizeInBytes) override;
private:
void incrementFrameCount();
[[nodiscard]] ConstSocketBuffers generatePacket(std::istream& inputStream, std::uint32_t sizeInBytes);
[[nodiscard]] std::streamsize getFirstEDPacket(std::istream& inputStream, std::uint32_t payloadSize);
[[nodiscard]] std::streamsize getNextEDPacket(std::istream& inputStream, std::uint32_t payloadSize);
[[nodiscard]] ConstSocketBuffers addEofFrame();
void setEOF(bool atEnd);
[[nodiscard]] bool isAtEnd() const;
std::array<BytesBuffer::value_type, EDHeader::HeaderSizeInBytes> headerBuffer;
BytesBuffer payloadBuffer;
std::optional<std::uint32_t> repeatPacketCount;
std::streamsize repeatedPayloadLength;
std::string filenameAsSisl;
};
#endif // ENTERPRISEDIODEFILETRANSFER_STANDARDPACKETGENERATOR_HPP
|
lemma homeomorphic_compact: fixes f :: "'a::topological_space \<Rightarrow> 'b::t2_space" shows "compact s \<Longrightarrow> continuous_on s f \<Longrightarrow> (f ` s = t) \<Longrightarrow> inj_on f s \<Longrightarrow> s homeomorphic t"
|
If $g$ and $h$ are paths with the same endpoints, and the line segments between $g(t)$ and $h(t)$ are contained in $S$ for all $t$, then $g$ and $h$ are homotopic in $S$.
|
# Base - Reaction-diffusion
- author: Marcelo de Gomensoro Malheiros
- revision: 2020-09
- license: MIT (attribution is not required but greatly appreciated)
## Turing model
- diffusion rates are based on the ratio $r$ and scale $s$
- depends on explicitly clipping lower values at $L_a$ and $L_b$
- depends on explicitly clipping higher values at $U_a$ and $U_b$
\begin{align}
\frac{\partial{a}}{\partial{t}} &= 16 - a b + r s \nabla^2 a
\\
\\
\frac{\partial{b}}{\partial{t}} &= a b - b - 12 + s \nabla^2 b
\end{align}
```python
import numpy as np
from scipy import ndimage
def turing_model(ma, mb, ka, kb, la, lb, da, db, dt, ia, ib, sa, sb, wrap):
if wrap:
ndimage.convolve(ma, ka, output=la, mode='wrap')
ndimage.convolve(mb, kb, output=lb, mode='wrap')
else:
ndimage.convolve(ma, ka, output=la, mode='reflect')
ndimage.convolve(mb, kb, output=lb, mode='reflect')
na = ma + (16 - ma * mb + da * la) * dt
nb = mb + (ma * mb - mb - 12 + db * lb) * dt
global a, b
np.clip(na, ia, sa, out=a)
np.clip(nb, ib, sb, out=b)
```
## Simulation
Parameter list, with default values shown:
- `ratio=5` - ratio between A and B diffusion rates
- `scale=1` - overall scale of the pattern
- `speed=100` - percent of default time step
- `start=0` - start iteration counter
- `stop=1000` - final iteration counter
- `time=None` - simulation time (in milliseconds), used instead of `stop` and taking into account `speed`
- `use_a=False` - use previous values for A?
- `use_b=False` - use previous values for B?
- `wrap=True` - use toroidal domain if true, non-flux boundary otherwise
- `seed=1` - random seed
- `ini_a=4` - initial constant values for A
- `ini_b=4` - initial constant values for B
- `var_a=0` - added randomness magnitude for A
- `var_b=1` - added randomness magnitude for B
- `shape=40` - domain dimension (single integer for square, or tuple)
- `inf_a=0` - lower bound for A
- `inf_b=0` - lower bound for B
- `sup_a=1000` - upper bound for A
- `sup_b=1000` - upper bound for B
- `axis=False` - show domain size?
- `cmap='inferno'` - Matplotlib colormap used
- `first=False` - show initial state?
- `info=False` - monitor concentration intervals (each 100 iterations, may be changed)
- `limit=None` - plot images with given dimension
- `show='a'` - reagents to show (can be the empty string, either `a` or `b`, or both)
- `size=2` - image output size
- `snap=4` - how many captures are shown (can also be a list of iteration counts)
- `detail=None` - show 1-D plot at given domain row (A in orange and B in blue)
- `extent=(0, 10)` - upper and lower values for 1-D plot
- `func=None` - auxiliary function
- `out=None` - output file name (PDF/PNG/JPG/...)
- `dpi=100` - resolution for output
- `interpolation='bilinear'` - used when converting a matrix to an image
- `detect=False` - detect constant-valued and stable pattern states, besides numerical problems (each 100 iterations, may be changed)
- `model=turing_model` - model function used
Global variables set after the simulation is run:
- `a` - final concentrations for A
- `b` - final concentrations for B
- `sim` - information about the simulation (can be used as an object or a dict)
```python
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
# turing: bounded non-linear Turing reaction-diffusion model - v6.3
kernel_a = kernel_b = np.array([[1, 4, 1], [4, -20, 4], [1, 4, 1]]) / 6
class Bunch(dict):
def __init__(self, dictionary):
dict.__init__(self, dictionary)
self.__dict__.update(dictionary)
def turing(ratio=5, scale=1, speed=100, start=0, stop=1000, time=None, use_a=False, use_b=False, wrap=True,
seed=1, ini_a=4, ini_b=4, var_a=0, var_b=1, shape=40, inf_a=0, inf_b=0, sup_a=1000, sup_b=1000,
axis=False, cmap='inferno', first=False, info=False, limit=None, show='a', size=2, snap=4,
detail=None, extent=(0, 10), func=None, out=None, dpi=100, interpolation='bilinear',
detect=False, model=turing_model):
# simulation init
diff_a = ratio * scale
diff_b = scale
delta_t = 0.01 * speed / 100
if time: stop = int(time * 100 / speed) + start
global sim, a, b
np.random.seed(seed)
if type(shape) == int: shape = (shape, shape)
if not use_a:
a = np.full(shape, ini_a, dtype=float)
if var_a != 0: a += np.random.random_sample(shape) * var_a
if not use_b:
b = np.full(shape, ini_b, dtype=float)
if var_b != 0: b += np.random.random_sample(shape) * var_b
lap_a = np.empty_like(a)
lap_b = np.empty_like(b)
is_nan = is_stable = is_uniform = last_a = False
if info:
high_a = high_b = - float('inf')
low_a = low_b = float('inf')
if info is True: info = 100
if detect is True: detect = 100
# plotting helper functions
def draw(matrix, row):
if axis: axes[row, col].axis('on')
axes[row, col].imshow(matrix, cmap=cmap, interpolation=interpolation)
axes[row, col].set_anchor('N')
if limit:
axes[row, col].set_xbound(0, limit[1] - 1)
axes[row, col].set_ybound(0, limit[0] - 1)
def plot():
axes[0, col].set_title(iteration)
row = 0
if detail:
if 'a' in show:
t = a.copy()
t[detail - 1,:] = t[detail + 1,:] = a.min()
draw(t, row); row += 1
if 'b' in show:
t = b.copy()
t[detail - 1,:] = t[detail + 1,:] = b.min()
draw(t, row); row += 1
else:
if 'a' in show: draw(a, row); row += 1
if 'b' in show: draw(b, row); row += 1
if detail:
axes[row, col].axis('on')
axes[row, col].get_xaxis().set_visible(False)
axes[row, col].grid()
axes[row, col].plot((inf_a,) * shape[1], color='orange', linestyle='--')
axes[row, col].plot((sup_a,) * shape[1], color='orange', linestyle='--')
axes[row, col].plot(a[detail], color='orange')
axes[row, col].plot((inf_b,) * shape[1], color='blue', linestyle='--')
axes[row, col].plot((sup_b,) * shape[1], color='blue', linestyle='--')
axes[row, col].plot(b[detail], color='blue')
axes[row, col].set_anchor('N')
axes[row, col].set_ybound(extent[0], extent[1])
# plotting init
axes = ax = ay = col = fig = rows = 0
if 'a' in show: rows += 1
if 'b' in show: rows += 1
if detail: rows += 1
if type(snap) == int:
if snap > 100: print("too many captures, check 'snap' parameter"); return
if first: snap = np.linspace(start, stop, snap, dtype=int)
else: snap = np.linspace(start, stop, snap + 1, dtype=int)[1:]
cols = len(snap)
if show:
fig, axes = plt.subplots(rows, cols, squeeze=False, figsize=(cols * size, rows * size))
for ay in axes:
for ax in ay: ax.axis('off')
if first and show:
iteration = start
plot()
col += 1
if type(limit) == int: limit = (limit, limit)
# simulation loop
for iteration in range(start + 1, stop + 1):
if func: func(iteration, seed)
if detect and iteration % detect == 0: last_a = a.copy()
if a.shape != shape:
shape = a.shape
lap_a = np.empty_like(a)
lap_b = np.empty_like(b)
model(a, b, kernel_a, kernel_b, lap_a, lap_b, diff_a, diff_b, delta_t, inf_a, inf_b, sup_a, sup_b, wrap)
if info and iteration % info == 0:
high_a = max(a.max(), high_a)
high_b = max(b.max(), high_b)
low_a = min(a.min(), low_a)
low_b = min(b.min(), low_b)
if detect and iteration % detect == 0:
if a.ptp() < 0.001 or b.ptp() < 0.001: is_uniform = True
elif np.isnan(np.sum(a)): is_nan = True
elif type(last_a) != bool and np.allclose(a, last_a, atol=0.00001, rtol=0): is_stable = True
last_a = a.copy()
if is_stable or iteration in snap:
if show: plot()
col += 1
if is_stable or is_uniform or is_nan: break
# finalization
if info:
min_a, max_a, min_b, max_b = a.min(), a.max(), b.min(), b.max()
print('A [{:.2f}, {:.2f}] <{:.2f}, {:.2f}> '.format(min_a, max_a, low_a, high_a),
'B [{:.2f}, {:.2f}] <{:.2f}, {:.2f}> '.format(min_b, max_b, low_b, high_b), end=' ')
if is_stable: print('stability of A at {}'.format(iteration))
elif is_uniform: print('uniformity of A or B at {}'.format(iteration))
elif is_nan: print('NaN found in A at {}'.format(iteration))
else: print()
if col == 0 or not show: plt.close()
else:
plt.show()
if out: fig.savefig(out, bbox_inches='tight', dpi=dpi)
del axes, ax, ay, col, cols, draw, fig, last_a, lap_a, lap_b, plot, rows
sim = Bunch(locals())
```
## Simple validation
```python
turing()
```
## Usage examples
```python
# show A, B and 1D detail view (dashed lines are the lower and upper bounds for concentrations)
# show initial state (iteration 0)
# enforce a lower bound for B and an upper bound for A
turing(show='ab', detail=12, extent=(-1,7), first=True, snap=5, stop=2000, scale=2, inf_b=1.0, sup_a=5.5)
```
```python
# set non-zero 'start' iteration count
# 'time' adjusts number of iterations accordingly to speed
turing(ratio=15, stop=2000)
turing(ratio=15, start=1000, time=2000, speed=50)
```
```python
# skip output, but still stop at a stable pattern
turing(detect=True, info=True, ini_a=4, ini_b=4, var_b=2, stop=10000, show='')
```
A [2.67, 7.31] <2.67, 8.13> B [0.00, 8.49] <0.00, 8.51> stability of A at 8700
```python
# stop prematurely when concentrations turn constant
turing(detect=True, ini_a=3, ini_b=4, var_b=0.1)
print('is uniform?', sim.is_uniform)
```
is uniform? True
```python
# fields available for simulation object
for i in sorted(sim):
print(i + '=' + repr(sim[i]))
```
axis=False
cmap='inferno'
delta_t=0.01
detail=None
detect=100
diff_a=5
diff_b=1
dpi=100
extent=(0, 10)
first=False
func=None
inf_a=0
inf_b=0
info=False
ini_a=3
ini_b=4
interpolation='bilinear'
is_nan=False
is_stable=False
is_uniform=True
iteration=200
limit=None
model=<function turing_model at 0x7fc1e07a3c20>
out=None
ratio=5
scale=1
seed=1
shape=(40, 40)
show='a'
size=2
snap=array([ 250, 500, 750, 1000])
speed=100
start=0
stop=1000
sup_a=1000
sup_b=1000
time=None
use_a=False
use_b=False
var_a=0
var_b=0.1
wrap=True
|
#redirect Davis Cooperative Community Network
|
{-# OPTIONS --cubical --safe #-}
module Relation.Nullary.Decidable.Properties where
open import Relation.Nullary.Decidable
open import Level
open import Relation.Nullary.Stable
open import Data.Empty
open import HLevels
open import Data.Empty.Properties using (isProp¬)
open import Data.Unit
open import Data.Empty
Dec→Stable : ∀ {ℓ} (A : Type ℓ) → Dec A → Stable A
Dec→Stable A (yes x) = λ _ → x
Dec→Stable A (no x) = λ f → ⊥-elim (f x)
isPropDec : (Aprop : isProp A) → isProp (Dec A)
isPropDec Aprop (yes a) (yes a') i = yes (Aprop a a' i)
isPropDec Aprop (yes a) (no ¬a) = ⊥-elim (¬a a)
isPropDec Aprop (no ¬a) (yes a) = ⊥-elim (¬a a)
isPropDec {A = A} Aprop (no ¬a) (no ¬a') i = no (isProp¬ A ¬a ¬a' i)
True : Dec A → Type
True (yes _) = ⊤
True (no _) = ⊥
toWitness : {x : Dec A} → True x → A
toWitness {x = yes p} _ = p
open import Path
open import Data.Bool.Base
from-reflects : ∀ b → (d : Dec A) → Reflects A b → does d ≡ b
from-reflects false (no y) r = refl
from-reflects false (yes y) r = ⊥-elim (r y)
from-reflects true (no y) r = ⊥-elim (y r)
from-reflects true (yes y) r = refl
|
[STATEMENT]
lemma n_one:
"n(1) = bot"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. n (1::'a) = bot
[PROOF STEP]
by (metis mult_left_one n_mult_bot n_bot)
|
module Go
public export
data GoInterface : String -> Type where
MkInterface : (iface : String) -> GoInterface iface
public export
data Go_FFI_Call = Function String
| Method (GoInterface iface) String
public export
data GoPtr : (a : Type) -> Type where -- XXX limit to Go_Types?
MkGoPtr : (x : a) -> GoPtr a
||| A byte
public export
data Byte : Type where
MkByte : (ch : Char) -> Byte
%used MkByte ch
mutual
||| Go foreign types
public export
data Go_Types : Type -> Type where
Go_Byte : Go_Types Byte
Go_Int : Go_Types Int
Go_Str : Go_Types String
Go_Unit : Go_Types ()
Go_Interface : Go_Types (GoInterface a)
Go_Nilable : Go_Types a -> Go_Types (Maybe a)
Go_Ptr : Go_Types a -> Go_Types (GoPtr a)
Go_Any : Go_Types (FFI_C.Raw a)
-- Note that this is actually only valid as return value
Go_MultiVal : (Go_Types a, Go_Types b) -> Go_Types (a, b)
public export
FFI_Go : FFI
FFI_Go = MkFFI Go_Types Go_FFI_Call String
public export
GIO : Type -> Type
GIO = IO' FFI_Go
public export
%inline
gocall : (f : Go_FFI_Call) -> (ty : Type) -> {auto fty : FTy FFI_Go [] ty} -> ty
gocall f ty = foreign FFI_Go f ty
|
lemma contour_integral_part_circlepath_eq: assumes "a < b" shows "contour_integral (part_circlepath c r a b) f = integral {a..b} (\<lambda>t. f (c + r * cis t) * r * \<i> * cis t)"
|
The unit factor of a monomial is the unit factor of its coefficient.
|
If $f$ is $C$-Lipschitz on $U$, then $a f$ is $(D C)$-Lipschitz on $U$, where $|a| \leq D$.
|
If $f$ is $C$-Lipschitz on $U$, then $a f$ is $(D C)$-Lipschitz on $U$, where $|a| \leq D$.
|
function generate_cell_lists( particle_type::String,
R::Array{Float64, 2},
Lx::Float64,
Ly::Float64,
Lz::Float64,
X::Array{Float64, 1},
Y::Array{Float64, 1},
Z::Array{Float64, 1},
Q0::Array{Float64, 1},
Q1::Array{Float64, 1},
Q2::Array{Float64, 1},
Q3::Array{Float64, 1},
number_of_cells_x::Int64,
number_of_cells_y::Int64,
number_of_cells_z::Int64,
cell_overlap::Float64)
# Number of particles.
number_of_particles::Int64 = length(X)
# Create cell dimension data structures.
cell_bounds_x::Array{Float64, 1} = linspace(0.0, Lx, number_of_cells_x + 1)
lbx_cell::Array{Float64, 1} = cell_bounds_x[1:end-1] - cell_overlap
ubx_cell::Array{Float64, 1} = cell_bounds_x[2:end] + cell_overlap
cell_bounds_y::Array{Float64, 1} = linspace(0.0, Ly, number_of_cells_y + 1)
lby_cell::Array{Float64, 1} = cell_bounds_y[1:end-1] - cell_overlap
uby_cell::Array{Float64, 1} = cell_bounds_y[2:end] + cell_overlap
cell_bounds_z::Array{Float64, 1} = linspace(0.0, Lz, number_of_cells_z + 1)
lbz_cell::Array{Float64, 1} = cell_bounds_z[1:end-1] - cell_overlap
ubz_cell::Array{Float64, 1} = cell_bounds_z[2:end] + cell_overlap
# Cell lists data structure.
cell_lists = Array{Array{Int64, 1}}(number_of_cells_x, number_of_cells_y, number_of_cells_z)
for current_cell_x = 1:number_of_cells_x
for current_cell_y = 1:number_of_cells_y
for current_cell_z = 1:number_of_cells_z
cell_lists[current_cell_x, current_cell_y, current_cell_z] = Array{Int64}(0)
end
end
end
# Compute cell lists.
a11::Float64 = 0.0
a12::Float64 = 0.0
a13::Float64 = 0.0
a21::Float64 = 0.0
a22::Float64 = 0.0
a23::Float64 = 0.0
a31::Float64 = 0.0
a32::Float64 = 0.0
a33::Float64 = 0.0
xAB::Float64 = 0.0
yAB::Float64 = 0.0
zAB::Float64 = 0.0
if particle_type == "sphere"
# For now we do a simple AABB-AABB intersection test.
# Should implement the exact test later because there will be some false positives now.
for current_cell_x = 1:number_of_cells_x
for current_cell_y = 1:number_of_cells_y
for current_cell_z = 1:number_of_cells_z
for current_particle = 1:number_of_particles
xAB = signed_distance_mod(X[current_particle], 0.5 * (lbx_cell[current_cell_x] + ubx_cell[current_cell_x]), Lx)
yAB = signed_distance_mod(Y[current_particle], 0.5 * (lby_cell[current_cell_y] + uby_cell[current_cell_y]), Ly)
zAB = signed_distance_mod(Z[current_particle], 0.5 * (lbz_cell[current_cell_z] + ubz_cell[current_cell_z]), Lz)
if overlap_cuboid_binary(xAB, yAB, zAB, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0,
R[current_particle, 1], R[current_particle, 1], R[current_particle, 1], # SIC!
0.5 * (ubx_cell[current_cell_x] - lbx_cell[current_cell_x]),
0.5 * (uby_cell[current_cell_y] - lby_cell[current_cell_y]),
0.5 * (ubz_cell[current_cell_z] - lbz_cell[current_cell_z])) == 1.0
push!(cell_lists[current_cell_x, current_cell_y, current_cell_z], current_particle)
end
end
end
end
end
elseif particle_type == "ellipse"
error("Not implemented yet.")
elseif particle_type == "ellipsoid"
# For now we approximate the ellipsoid with its OBB i.e. the bounding cuboid with same semi-axes.
# Should implement the exact test later because there will be some false positives now.
for current_cell_x = 1:number_of_cells_x
for current_cell_y = 1:number_of_cells_y
for current_cell_z = 1:number_of_cells_z
for current_particle = 1:number_of_particles
xAB = signed_distance_mod(X[current_particle], 0.5 * (lbx_cell[current_cell_x] + ubx_cell[current_cell_x]), Lx)
yAB = signed_distance_mod(Y[current_particle], 0.5 * (lby_cell[current_cell_y] + uby_cell[current_cell_y]), Ly)
zAB = signed_distance_mod(Z[current_particle], 0.5 * (lbz_cell[current_cell_z] + ubz_cell[current_cell_z]), Lz)
(a11, a12, a13, a21, a22, a23, a31, a32, a33) = rotation_matrix(Q0[current_particle], Q1[current_particle], Q2[current_particle], Q3[current_particle])
if overlap_cuboid_binary(xAB, yAB, zAB, a11, a12, a13, a21, a22, a23, a31, a32, a33, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0,
R[current_particle, 1], R[current_particle, 2], R[current_particle, 3],
0.5 * (ubx_cell[current_cell_x] - lbx_cell[current_cell_x]),
0.5 * (uby_cell[current_cell_y] - lby_cell[current_cell_y]),
0.5 * (ubz_cell[current_cell_z] - lbz_cell[current_cell_z])) == 1.0
push!(cell_lists[current_cell_x, current_cell_y, current_cell_z], current_particle)
end
end
end
end
end
elseif particle_type == "cuboid"
for current_cell_x = 1:number_of_cells_x
for current_cell_y = 1:number_of_cells_y
for current_cell_z = 1:number_of_cells_z
for current_particle = 1:number_of_particles
xAB = signed_distance_mod(X[current_particle], 0.5 * (lbx_cell[current_cell_x] + ubx_cell[current_cell_x]), Lx)
yAB = signed_distance_mod(Y[current_particle], 0.5 * (lby_cell[current_cell_y] + uby_cell[current_cell_y]), Ly)
zAB = signed_distance_mod(Z[current_particle], 0.5 * (lbz_cell[current_cell_z] + ubz_cell[current_cell_z]), Lz)
(a11, a12, a13, a21, a22, a23, a31, a32, a33) = rotation_matrix(Q0[current_particle], Q1[current_particle], Q2[current_particle], Q3[current_particle])
if overlap_cuboid_binary(xAB, yAB, zAB, a11, a12, a13, a21, a22, a23, a31, a32, a33, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0,
R[current_particle, 1], R[current_particle, 2], R[current_particle, 3],
0.5 * (ubx_cell[current_cell_x] - lbx_cell[current_cell_x]),
0.5 * (uby_cell[current_cell_y] - lby_cell[current_cell_y]),
0.5 * (ubz_cell[current_cell_z] - lbz_cell[current_cell_z])) == 1.0
push!(cell_lists[current_cell_x, current_cell_y, current_cell_z], current_particle)
end
end
end
end
end
elseif particle_type == "superellipsoid"
# For now we approximate the ellipsoid with its OBB i.e. the bounding cuboid with the same semi-axes.
# Should implement the exact test later because there will be some false positives now.
for current_cell_x = 1:number_of_cells_x
for current_cell_y = 1:number_of_cells_y
for current_cell_z = 1:number_of_cells_z
for current_particle = 1:number_of_particles
xAB = signed_distance_mod(X[current_particle], 0.5 * (lbx_cell[current_cell_x] + ubx_cell[current_cell_x]), Lx)
yAB = signed_distance_mod(Y[current_particle], 0.5 * (lby_cell[current_cell_y] + uby_cell[current_cell_y]), Ly)
zAB = signed_distance_mod(Z[current_particle], 0.5 * (lbz_cell[current_cell_z] + ubz_cell[current_cell_z]), Lz)
(a11, a12, a13, a21, a22, a23, a31, a32, a33) = rotation_matrix(Q0[current_particle], Q1[current_particle], Q2[current_particle], Q3[current_particle])
if overlap_cuboid_binary(xAB, yAB, zAB, a11, a12, a13, a21, a22, a23, a31, a32, a33, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0,
R[current_particle, 1], R[current_particle, 2], R[current_particle, 3],
0.5 * (ubx_cell[current_cell_x] - lbx_cell[current_cell_x]),
0.5 * (uby_cell[current_cell_y] - lby_cell[current_cell_y]),
0.5 * (ubz_cell[current_cell_z] - lbz_cell[current_cell_z])) == 1.0
push!(cell_lists[current_cell_x, current_cell_y, current_cell_z], current_particle)
end
end
end
end
end
end
return cell_lists
end
|
\documentclass[10pt, a4paper, openany, fleqn,%
headinclude, footinclude, parskip=half,%
numbers=noenddot, cleardoublepage=empty]{scrreprt}
\usepackage[a4paper, total={16.5cm, 24.2cm}]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{mathpazo} %-- use Palatino font
\usepackage[left=25mm, top=25mm]{geometry}
\usepackage{amsmath, amssymb, amsthm}
\usepackage[square]{natbib}
\usepackage{subcaption}
\usepackage{xspace}
\usepackage[breaklinks=true,
colorlinks=true,
linktocpage=true,
allcolors=colorforlinks]{hyperref}
\usepackage[ruled, vlined, algochapter, linesnumbered]{algorithm2e}
\usepackage{calc}
\usepackage{ccicons}
\usepackage{xspace}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage[english]{babel}
\usepackage{listings}
\usepackage{scrhack} % ignore warnings about deprecated KOMA-Script
\usepackage[printonlyused, smaller, withpage]{acronym}
\usepackage[usenames, dvipsnames]{xcolor}
\usepackage{graphicx}
\usepackage{pdfpages}
\usepackage{wrapfig}
\usepackage[format=plain, font=small,labelfont=bf]{caption}
\usepackage{url}
\usepackage{chngcntr}
\counterwithin{figure}{section}
\counterwithin{table}{section}
\usepackage{multicol}
\makeatletter
\renewcommand{\thesection}{%
\ifnum\c@chapter<1 \@arabic\c@section
\else \thechapter.\@arabic\c@section
\fi
}
\makeatother
\makeatletter
\renewenvironment{thebibliography}[1]{%
\section*{\refname \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}}%
\begin{multicols}{2}
\list{\@biblabel{\@arabic\c@enumiv}}{%
\settowidth\labelwidth{\@biblabel{#1}}%
\leftmargin\labelwidth
\advance\leftmargin\labelsep
\@openbib@code
\usecounter{enumiv}%
\let\p@enumiv\@empty
\renewcommand\theenumiv{\@arabic\c@enumiv}}%
\sloppy
\clubpenalty4000
\@clubpenalty \clubpenalty
\widowpenalty4000%
\sfcode`\.\@m}
{
\def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}%
\endlist\end{multicols}
}
\makeatother
\input{mysettings}
\begin{document}
%******************************************************************
% Frontmatter
%******************************************************************
\frontmatter
\begin{titlepage}
\null\vskip 4.5em
\begin{center}
{%
\usekomafont{subject}{%
MSc Graduation Plan (P2) in Geomatics
\par}%
}%
\vskip 2em
{%
\usekomafont{title}{\huge
\myTitle
\par}%
}%
\vskip 3em
{%
\usekomafont{author}{%
\lineskip 0.75em
\myName\\*
\textit{Student 5142334}\\*
\href{mailto:[email protected]}{[email protected]}\par
\vskip 1em
\begin{tabular}{ll}
Supervisors: & 1\textsuperscript{st} – \mySupervisorOne \\
& 2\textsuperscript{nd} – \mySupervisorTwo \\
\end{tabular}
\vskip 1em
P2 Date: 2020-01-19
\par}%
}%
\vfill
\includegraphics[width=5.5cm]{p2/figs/tud-3dgeoinfo-black.png}\par
\usekomafont{date}{\today \par}%
\end{center}
\end{titlepage}
%******************************************************************
% Mainmatter
%******************************************************************
\mainmatter
\input{chapters/introduction}
\input{chapters/relatedwork}
\input{chapters/researchquestions}
\input{chapters/toolsanddatasets}
\input{chapters/methodology}
\input{chapters/projectschedule}
% *****************************************************************
% Backmatter
%******************************************************************
\backmatter
\bibliographystyle{apalike}
\bibliography{myreferences}
\end{document}
|
[GOAL]
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F : Presheaf CommRingCat X
G : SubmonoidPresheaf F
U : (Opens ↑X)ᵒᵖ
⊢ { obj := fun U => CommRingCat.of (Localization (obj G U)),
map := fun {U V} i =>
CommRingCat.ofHom
(IsLocalization.map (Localization (obj G V)) (F.map i)
(_ : obj G U ≤ Submonoid.comap (F.map i) (obj G V))) }.map
(𝟙 U) =
𝟙
({ obj := fun U => CommRingCat.of (Localization (obj G U)),
map := fun {U V} i =>
CommRingCat.ofHom
(IsLocalization.map (Localization (obj G V)) (F.map i)
(_ : obj G U ≤ Submonoid.comap (F.map i) (obj G V))) }.obj
U)
[PROOFSTEP]
simp_rw [F.map_id]
[GOAL]
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F : Presheaf CommRingCat X
G : SubmonoidPresheaf F
U : (Opens ↑X)ᵒᵖ
⊢ CommRingCat.ofHom
(IsLocalization.map (Localization (obj G U)) (𝟙 (F.obj U))
(_ : obj G U ≤ Submonoid.comap (𝟙 (F.obj U)) (obj G U))) =
𝟙 (CommRingCat.of (Localization (obj G U)))
[PROOFSTEP]
ext x
[GOAL]
case w
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F : Presheaf CommRingCat X
G : SubmonoidPresheaf F
U : (Opens ↑X)ᵒᵖ
x : (forget CommRingCat).obj (CommRingCat.of (Localization (obj G U)))
⊢ ↑(CommRingCat.ofHom
(IsLocalization.map (Localization (obj G U)) (𝟙 (F.obj U))
(_ : obj G U ≤ Submonoid.comap (𝟙 (F.obj U)) (obj G U))))
x =
↑(𝟙 (CommRingCat.of (Localization (obj G U)))) x
[PROOFSTEP]
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
[GOAL]
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F : Presheaf CommRingCat X
G : SubmonoidPresheaf F
U V W : (Opens ↑X)ᵒᵖ
i : U ⟶ V
j : V ⟶ W
⊢ { obj := fun U => CommRingCat.of (Localization (obj G U)),
map := fun {U V} i =>
CommRingCat.ofHom
(IsLocalization.map (Localization (obj G V)) (F.map i)
(_ : obj G U ≤ Submonoid.comap (F.map i) (obj G V))) }.map
(i ≫ j) =
{ obj := fun U => CommRingCat.of (Localization (obj G U)),
map := fun {U V} i =>
CommRingCat.ofHom
(IsLocalization.map (Localization (obj G V)) (F.map i)
(_ : obj G U ≤ Submonoid.comap (F.map i) (obj G V))) }.map
i ≫
{ obj := fun U => CommRingCat.of (Localization (obj G U)),
map := fun {U V} i =>
CommRingCat.ofHom
(IsLocalization.map (Localization (obj G V)) (F.map i)
(_ : obj G U ≤ Submonoid.comap (F.map i) (obj G V))) }.map
j
[PROOFSTEP]
delta CommRingCat.ofHom CommRingCat.of Bundled.of
[GOAL]
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F : Presheaf CommRingCat X
G : SubmonoidPresheaf F
U V W : (Opens ↑X)ᵒᵖ
i : U ⟶ V
j : V ⟶ W
⊢ { obj := fun U => Bundled.mk (Localization (obj G U)),
map := fun {U V} i =>
IsLocalization.map (Localization (obj G V)) (F.map i)
(_ : obj G U ≤ Submonoid.comap (F.map i) (obj G V)) }.map
(i ≫ j) =
{ obj := fun U => Bundled.mk (Localization (obj G U)),
map := fun {U V} i =>
IsLocalization.map (Localization (obj G V)) (F.map i)
(_ : obj G U ≤ Submonoid.comap (F.map i) (obj G V)) }.map
i ≫
{ obj := fun U => Bundled.mk (Localization (obj G U)),
map := fun {U V} i =>
IsLocalization.map (Localization (obj G V)) (F.map i)
(_ : obj G U ≤ Submonoid.comap (F.map i) (obj G V)) }.map
j
[PROOFSTEP]
simp_rw [F.map_comp, CommRingCat.comp_eq_ring_hom_comp]
[GOAL]
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F : Presheaf CommRingCat X
G : SubmonoidPresheaf F
U V W : (Opens ↑X)ᵒᵖ
i : U ⟶ V
j : V ⟶ W
⊢ IsLocalization.map (Localization (obj G W)) (RingHom.comp (F.map j) (F.map i))
(_ : obj G U ≤ Submonoid.comap (RingHom.comp (F.map j) (F.map i)) (obj G W)) =
RingHom.comp
(IsLocalization.map (Localization (obj G W)) (F.map j) (_ : obj G V ≤ Submonoid.comap (F.map j) (obj G W)))
(IsLocalization.map (Localization (obj G V)) (F.map i) (_ : obj G U ≤ Submonoid.comap (F.map i) (obj G V)))
[PROOFSTEP]
rw [IsLocalization.map_comp_map]
[GOAL]
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F : Presheaf CommRingCat X
G : SubmonoidPresheaf F
S : (x : ↑X) → Submonoid ↑(stalk F x)
U V : (Opens ↑X)ᵒᵖ
i : U ⟶ V
⊢ (fun U => ⨅ (x : { x // x ∈ U.unop }), Submonoid.comap (germ F x) (S ↑x)) U ≤
Submonoid.comap (F.map i) ((fun U => ⨅ (x : { x // x ∈ U.unop }), Submonoid.comap (germ F x) (S ↑x)) V)
[PROOFSTEP]
intro s hs
[GOAL]
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F : Presheaf CommRingCat X
G : SubmonoidPresheaf F
S : (x : ↑X) → Submonoid ↑(stalk F x)
U V : (Opens ↑X)ᵒᵖ
i : U ⟶ V
s : (forget CommRingCat).obj (F.obj U)
hs : s ∈ (fun U => ⨅ (x : { x // x ∈ U.unop }), Submonoid.comap (germ F x) (S ↑x)) U
⊢ s ∈ Submonoid.comap (F.map i) ((fun U => ⨅ (x : { x // x ∈ U.unop }), Submonoid.comap (germ F x) (S ↑x)) V)
[PROOFSTEP]
simp only [Submonoid.mem_comap, Submonoid.mem_iInf] at hs ⊢
[GOAL]
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F : Presheaf CommRingCat X
G : SubmonoidPresheaf F
S : (x : ↑X) → Submonoid ↑(stalk F x)
U V : (Opens ↑X)ᵒᵖ
i : U ⟶ V
s : (forget CommRingCat).obj (F.obj U)
hs : ∀ (i : { x // x ∈ U.unop }), ↑(germ F i) s ∈ S ↑i
⊢ ∀ (i_1 : { x // x ∈ V.unop }), ↑(germ F i_1) (↑(F.map i) s) ∈ S ↑i_1
[PROOFSTEP]
intro x
[GOAL]
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F : Presheaf CommRingCat X
G : SubmonoidPresheaf F
S : (x : ↑X) → Submonoid ↑(stalk F x)
U V : (Opens ↑X)ᵒᵖ
i : U ⟶ V
s : (forget CommRingCat).obj (F.obj U)
hs : ∀ (i : { x // x ∈ U.unop }), ↑(germ F i) s ∈ S ↑i
x : { x // x ∈ V.unop }
⊢ ↑(germ F x) (↑(F.map i) s) ∈ S ↑x
[PROOFSTEP]
change (F.map i.unop.op ≫ F.germ x) s ∈ _
[GOAL]
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F : Presheaf CommRingCat X
G : SubmonoidPresheaf F
S : (x : ↑X) → Submonoid ↑(stalk F x)
U V : (Opens ↑X)ᵒᵖ
i : U ⟶ V
s : (forget CommRingCat).obj (F.obj U)
hs : ∀ (i : { x // x ∈ U.unop }), ↑(germ F i) s ∈ S ↑i
x : { x // x ∈ V.unop }
⊢ ↑(F.map i.unop.op ≫ germ F x) s ∈ S ↑x
[PROOFSTEP]
rw [F.germ_res]
[GOAL]
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F : Presheaf CommRingCat X
G : SubmonoidPresheaf F
S : (x : ↑X) → Submonoid ↑(stalk F x)
U V : (Opens ↑X)ᵒᵖ
i : U ⟶ V
s : (forget CommRingCat).obj (F.obj U)
hs : ∀ (i : { x // x ∈ U.unop }), ↑(germ F i) s ∈ S ↑i
x : { x // x ∈ V.unop }
⊢ ↑(germ F ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U.unop) }) x)) s ∈ S ↑x
[PROOFSTEP]
exact hs _
[GOAL]
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
⊢ Mono (toTotalQuotientPresheaf (Sheaf.presheaf F))
[PROOFSTEP]
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
[GOAL]
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
this : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (NatTrans.app (toTotalQuotientPresheaf (Sheaf.presheaf F)) U)
⊢ Mono (toTotalQuotientPresheaf (Sheaf.presheaf F))
[PROOFSTEP]
apply NatTrans.mono_of_mono_app
[GOAL]
case this
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
⊢ ∀ (U : (Opens ↑X)ᵒᵖ), Mono (NatTrans.app (toTotalQuotientPresheaf (Sheaf.presheaf F)) U)
[PROOFSTEP]
intro U
[GOAL]
case this
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
U : (Opens ↑X)ᵒᵖ
⊢ Mono (NatTrans.app (toTotalQuotientPresheaf (Sheaf.presheaf F)) U)
[PROOFSTEP]
apply ConcreteCategory.mono_of_injective
[GOAL]
case this.i
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
U : (Opens ↑X)ᵒᵖ
⊢ Function.Injective ↑(NatTrans.app (toTotalQuotientPresheaf (Sheaf.presheaf F)) U)
[PROOFSTEP]
dsimp [toTotalQuotientPresheaf, CommRingCat.ofHom]
-- Porting note : this is a hack to make the `refine` below works
[GOAL]
case this.i
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
U : (Opens ↑X)ᵒᵖ
⊢ Function.Injective
↑(algebraMap (↑((Sheaf.presheaf F).obj U))
(Localization
(⨅ (x : { x // x ∈ U.unop }), Submonoid.comap (germ (Sheaf.presheaf F) x) (↑(stalk (Sheaf.presheaf F) ↑x))⁰)))
[PROOFSTEP]
set m := _
[GOAL]
case this.i
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
U : (Opens ↑X)ᵒᵖ
m : ?m.65485 := ?m.65486
⊢ Function.Injective
↑(algebraMap (↑((Sheaf.presheaf F).obj U))
(Localization
(⨅ (x : { x // x ∈ U.unop }), Submonoid.comap (germ (Sheaf.presheaf F) x) (↑(stalk (Sheaf.presheaf F) ↑x))⁰)))
[PROOFSTEP]
change Function.Injective (algebraMap _ (Localization m))
[GOAL]
case this.i
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
U : (Opens ↑X)ᵒᵖ
m : Submonoid ((forget CommRingCat).obj ((Sheaf.presheaf F).obj U)) :=
⨅ (x : { x // x ∈ U.unop }), Submonoid.comap (germ (Sheaf.presheaf F) x) (↑(stalk (Sheaf.presheaf F) ↑x))⁰
⊢ Function.Injective ↑(algebraMap ((forget CommRingCat).obj ((Sheaf.presheaf F).obj U)) (Localization m))
[PROOFSTEP]
change Function.Injective (algebraMap (F.presheaf.obj U) _)
[GOAL]
case this.i
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
U : (Opens ↑X)ᵒᵖ
m : Submonoid ((forget CommRingCat).obj ((Sheaf.presheaf F).obj U)) :=
⨅ (x : { x // x ∈ U.unop }), Submonoid.comap (germ (Sheaf.presheaf F) x) (↑(stalk (Sheaf.presheaf F) ↑x))⁰
⊢ Function.Injective ↑(algebraMap (↑((Sheaf.presheaf F).obj U)) (Localization m))
[PROOFSTEP]
haveI : IsLocalization _ (Localization m) := Localization.isLocalization
[GOAL]
case this.i
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
U : (Opens ↑X)ᵒᵖ
m : Submonoid ((forget CommRingCat).obj ((Sheaf.presheaf F).obj U)) :=
⨅ (x : { x // x ∈ U.unop }), Submonoid.comap (germ (Sheaf.presheaf F) x) (↑(stalk (Sheaf.presheaf F) ↑x))⁰
this : IsLocalization m (Localization m)
⊢ Function.Injective ↑(algebraMap (↑((Sheaf.presheaf F).obj U)) (Localization m))
[PROOFSTEP]
refine IsLocalization.injective (M := m) (S := Localization m) ?_
[GOAL]
case this.i
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
U : (Opens ↑X)ᵒᵖ
m : Submonoid ((forget CommRingCat).obj ((Sheaf.presheaf F).obj U)) :=
⨅ (x : { x // x ∈ U.unop }), Submonoid.comap (germ (Sheaf.presheaf F) x) (↑(stalk (Sheaf.presheaf F) ↑x))⁰
this : IsLocalization m (Localization m)
⊢ m ≤ ((forget CommRingCat).obj ((Sheaf.presheaf F).obj U))⁰
[PROOFSTEP]
intro s hs t e
[GOAL]
case this.i
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
U : (Opens ↑X)ᵒᵖ
m : Submonoid ((forget CommRingCat).obj ((Sheaf.presheaf F).obj U)) :=
⨅ (x : { x // x ∈ U.unop }), Submonoid.comap (germ (Sheaf.presheaf F) x) (↑(stalk (Sheaf.presheaf F) ↑x))⁰
this : IsLocalization m (Localization m)
s : (forget CommRingCat).obj ((Sheaf.presheaf F).obj U)
hs : s ∈ m
t : (forget CommRingCat).obj ((Sheaf.presheaf F).obj U)
e : t * s = 0
⊢ t = 0
[PROOFSTEP]
apply section_ext F (unop U)
[GOAL]
case this.i.h
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
U : (Opens ↑X)ᵒᵖ
m : Submonoid ((forget CommRingCat).obj ((Sheaf.presheaf F).obj U)) :=
⨅ (x : { x // x ∈ U.unop }), Submonoid.comap (germ (Sheaf.presheaf F) x) (↑(stalk (Sheaf.presheaf F) ↑x))⁰
this : IsLocalization m (Localization m)
s : (forget CommRingCat).obj ((Sheaf.presheaf F).obj U)
hs : s ∈ m
t : (forget CommRingCat).obj ((Sheaf.presheaf F).obj U)
e : t * s = 0
⊢ ∀ (x : { x // x ∈ U.unop }), ↑(germ (Sheaf.presheaf F) x) t = ↑(germ (Sheaf.presheaf F) x) 0
[PROOFSTEP]
intro x
[GOAL]
case this.i.h
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
U : (Opens ↑X)ᵒᵖ
m : Submonoid ((forget CommRingCat).obj ((Sheaf.presheaf F).obj U)) :=
⨅ (x : { x // x ∈ U.unop }), Submonoid.comap (germ (Sheaf.presheaf F) x) (↑(stalk (Sheaf.presheaf F) ↑x))⁰
this : IsLocalization m (Localization m)
s : (forget CommRingCat).obj ((Sheaf.presheaf F).obj U)
hs : s ∈ m
t : (forget CommRingCat).obj ((Sheaf.presheaf F).obj U)
e : t * s = 0
x : { x // x ∈ U.unop }
⊢ ↑(germ (Sheaf.presheaf F) x) t = ↑(germ (Sheaf.presheaf F) x) 0
[PROOFSTEP]
rw [map_zero]
[GOAL]
case this.i.h
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
U : (Opens ↑X)ᵒᵖ
m : Submonoid ((forget CommRingCat).obj ((Sheaf.presheaf F).obj U)) :=
⨅ (x : { x // x ∈ U.unop }), Submonoid.comap (germ (Sheaf.presheaf F) x) (↑(stalk (Sheaf.presheaf F) ↑x))⁰
this : IsLocalization m (Localization m)
s : (forget CommRingCat).obj ((Sheaf.presheaf F).obj U)
hs : s ∈ m
t : (forget CommRingCat).obj ((Sheaf.presheaf F).obj U)
e : t * s = 0
x : { x // x ∈ U.unop }
⊢ ↑(germ (Sheaf.presheaf F) x) t = 0
[PROOFSTEP]
apply Submonoid.mem_iInf.mp hs x
[GOAL]
case this.i.h.a
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
U : (Opens ↑X)ᵒᵖ
m : Submonoid ((forget CommRingCat).obj ((Sheaf.presheaf F).obj U)) :=
⨅ (x : { x // x ∈ U.unop }), Submonoid.comap (germ (Sheaf.presheaf F) x) (↑(stalk (Sheaf.presheaf F) ↑x))⁰
this : IsLocalization m (Localization m)
s : (forget CommRingCat).obj ((Sheaf.presheaf F).obj U)
hs : s ∈ m
t : (forget CommRingCat).obj ((Sheaf.presheaf F).obj U)
e : t * s = 0
x : { x // x ∈ U.unop }
⊢ ↑(germ (Sheaf.presheaf F) x) t * ↑(germ (Sheaf.presheaf F) x) s = 0
[PROOFSTEP]
dsimp
[GOAL]
case this.i.h.a
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
U : (Opens ↑X)ᵒᵖ
m : Submonoid ((forget CommRingCat).obj ((Sheaf.presheaf F).obj U)) :=
⨅ (x : { x // x ∈ U.unop }), Submonoid.comap (germ (Sheaf.presheaf F) x) (↑(stalk (Sheaf.presheaf F) ↑x))⁰
this : IsLocalization m (Localization m)
s : (forget CommRingCat).obj ((Sheaf.presheaf F).obj U)
hs : s ∈ m
t : (forget CommRingCat).obj ((Sheaf.presheaf F).obj U)
e : t * s = 0
x : { x // x ∈ U.unop }
⊢ ↑(germ (Sheaf.presheaf F) x) t * ↑(germ (Sheaf.presheaf F) x) s = 0
[PROOFSTEP]
rw [← map_mul, e, map_zero]
|
[STATEMENT]
lemma (in su_rel_fun) repr: "(f A = B) = ((A,B)\<in>F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (f A = B) = ((A, B) \<in> F)
[PROOF STEP]
using repr1 repr2
[PROOF STATE]
proof (prove)
using this:
(?A, f ?A) \<in> F
(?A, ?B) \<in> F \<Longrightarrow> ?B = f ?A
goal (1 subgoal):
1. (f A = B) = ((A, B) \<in> F)
[PROOF STEP]
by (blast)
\<comment> \<open>Contract quantification over two variables to pair\<close>
|
Watson also observes , " Similarly , the Dutch Defence looks particularly sterile when White achieves the reversed positions a tempo up ( it turns out that he has nothing useful to do ! ) ; and indeed , many standard Black openings are not very inspiring when one gets them as White , tempo in hand . " GM Alex <unk> likewise notes that GM Vladimir <unk> , a successful exponent of the Leningrad Dutch ( 1.d4 f5 <unk> g6 ) at the highest levels , " once made a deep impression on me by casually dismissing someone 's suggestion that he should try <unk> as White . He smiled and said , ' That extra move 's gonna hurt me . ' "
|
// Copyright (c) 2005 - 2012 Marc de Kamps
// 2012 David-Matthias Sichau
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
#ifndef MPILIB_UTILITIES_MPIPROXY_HPP_
#define MPILIB_UTILITIES_MPIPROXY_HPP_
//#include <MPILib/config.hpp>
#include <MPILib/include/utilities/Exception.hpp>
#include <MPILib/include/utilities/Singleton.hpp>
#include <MPILib/include/utilities/Log.hpp>
#ifdef ENABLE_MPI
#include <boost/mpi/request.hpp>
#include <boost/mpi/communicator.hpp>
#include <boost/mpi/collectives.hpp>
#include <boost/mpi/nonblocking.hpp>
namespace mpi = boost::mpi;
#endif // ENABLE_MPI
namespace MPILib {
namespace utilities {
/**
* @brief A class to handle all MPI related code. It also provides works if MPI is disabled
*
* MIIND relies on BOOST.MPI to simplify MPI calling.This class encapsulate all MPI related code. The class also works if MPI is not enabled,
* so that the code does not depend on whether MPI is enabled or not. At the moment only in the
* main method the MPI environment needs to be generated, i.e. the main program requires an
* mpi::environment instance to communicate run parameters, such as the number of processors
* to the program. Consult the largeNetwork program for an example on its definition.
* All other MPI calls are handled
* by this class, which encapsulates the mpi::world object. MIIND uses broadcasts and blocking irecv and isend calls for point-to-point calls.
*
*
*/
class MPIProxy_ {
public:
/**
* destructor
*/
virtual ~MPIProxy_();
/**
* wrapper method to return the process id, if mpi is disabled it returns 0
* @return the world rank of a process
*/
int getRank() const;
/**
* wrapper method to return the size, if MPI is disabled it returns 1
* @return
*/
int getSize() const;
/**
* wrapper for mpi barrier
*/
void barrier();
/**
* waits until all requests stored in the vector _mpiStatus are finished
*/
void waitAll();
/**
* Broadcast the value from root
* @param value The value to be broadcast
* @param root The root process
*/
template<typename T>
void broadcast(T&, int);
/**
* asynchronous receive operation the mpi status is stored in _mpiStatus
* @param source The source of the message
* @param tag The tag of the message
* @param value The value received
*/
template<typename T>
void irecv(int, int, T&) const;
/**
* asynchronous send operation the mpi status is stored in _mpiStatus
* @param dest The destination of the message
* @param tag The tag of the message
* @param value The value sended
*/
template<typename T>
void isend(int, int, const T&) const;
private:
/**
* Declare the Singleton class a friend to allow construction of the MPIProxy_ class
*/
friend class Singleton<MPIProxy_>;
/**
* constructor sets the MPI rank and size
*/
MPIProxy_();
#ifdef ENABLE_MPI
/**
* stores the mpi statuses
*/
static std::vector<boost::mpi::request> _mpiStatus;
#endif
/**
* storage of the rank to avoid function calls
*/
static int _rank;
/**
* storage of the size to avoid function calls
*/
static int _size;
};
template<typename T>
void MPIProxy_::broadcast(T& value, int root) {
#ifdef ENABLE_MPI
mpi::communicator world;
boost::mpi::broadcast(world, value, root);
#endif
}
template<typename T>
void MPIProxy_::irecv(int source, int tag, T& value) const {
#ifdef ENABLE_MPI
mpi::communicator world;
_mpiStatus.push_back(world.irecv(source, tag, value));
LOG(utilities::logDEBUG4)<<"recv source: "<<source<<"; tag: "<<tag<<"; value: "<<value;
#else
MPILib::utilities::Exception("MPI Code called from serial code in irecv");
#endif
}
template<typename T>
void MPIProxy_::isend
(int dest, int tag, const T& value) const {
#ifdef ENABLE_MPI
mpi::communicator world;
_mpiStatus.push_back(world.isend(dest, tag, value));
LOG(utilities::logDEBUG4)<<"send destination: "<<dest<<"; tag: "<<tag<<"; value: "<<value;
#else
MPILib::utilities::Exception("MPI Code called from serial code in isend");
#endif
}
/**
* Generate an singleton instance of the MPIProxy_ class.
*/
typedef Singleton<MPIProxy_> MPIProxySingleton;
/**
* Wrapper function to reduce the writing needed to access the MPIProxy_.
* inline this function to allow to definition in multiple translation units.
* @return The reference to the single instance of MPIProxy
*/
inline MPIProxy_& MPIProxy() {
return MPIProxySingleton::instance();
}
} /* namespace utilities */
} /* namespace MPILib */
#endif /* MPILIB_UTILITIES_MPIPROXY_HPP_ */
|
Fixpoint pow a b :=
match b with
| O => 1
| S n => a * pow a n
end.
Notation "a ^ b" := (pow a b).
Theorem testing_pow : forall (x y : nat), x ^ 2 = x * x.
Proof.
intros. simpl. induction x.
+ simpl. reflexivity.
+ simpl in *.
|
#ifndef PLAYER_HPP_
#define PLAYER_HPP_
#include <cstdint>
#include <boost/serialization/access.hpp>
#include "command.hpp"
#include "keyboard.hpp"
class player {
public:
static const uint8_t CLASS_ID = 1;
static const int DEFAULT_MOVE_SPEED = 2; // m/s
static const int DEFAULT_TURN_SPEED = 3; // rad/s
player()
: id_(0),
color_(0xffffffff), // 0xAABBGGRR
x_(0.0),
y_(0.0),
z_(0.0),
horz_angel_(0.0),
vert_angel_(0.0),
last_command_id_(0)
{
}
uint8_t get_id() const {
return id_;
}
void set_id(uint8_t id) {
id_ = id;
}
uint32_t get_color_AABBGGRR() const {
return color_;
}
void set_color_AABBGGRR(uint32_t color) {
color_ = color;
}
float get_x() const {
return x_;
}
void set_x(float x) {
x_ = x;
}
float get_y() const {
return y_;
}
void set_y(float y) {
y_ = y;
}
float get_z() const {
return z_;
}
void set_z(float z) {
z_ = z;
}
float get_horz_angel() const {
return horz_angel_;
}
void set_horz_angel(float angel) {
horz_angel_ = angel;
}
float get_vert_angel() const {
return vert_angel_;
}
void set_vert_angel(float angel) {
vert_angel_ = angel;
}
int get_last_command_id() const {
return last_command_id_;
}
void set_last_command_id(int command_id) {
last_command_id_ = command_id;
}
void run_command(const command& cmd) {
// remember this command
last_command_id_ = cmd.id;
// update angels
horz_angel_ += cmd.horz_delta_angel;
vert_angel_ += cmd.vert_delta_angel;
// handle action turn left and turn right
if ((cmd.buttons & keyboard::button::left) || (cmd.buttons & keyboard::button::right)) {
float add_angel = cmd.duration_ms * DEFAULT_TURN_SPEED / 1000.0;
horz_angel_ += (cmd.buttons & keyboard::button::left) ? add_angel : -add_angel;
}
// if no more actions except turn left and right then return
if (cmd.buttons == (keyboard::button::left | keyboard::button::right))
return;
float add_x, add_z;
float base_distance = cmd.duration_ms * DEFAULT_MOVE_SPEED / 1000.0;
// handle action move forward and move backward
if ((cmd.buttons & keyboard::button::forward) || (cmd.buttons & keyboard::button::backward)) {
add_x = base_distance * std::cos(horz_angel_);
add_z = base_distance * -std::sin(horz_angel_);
x_ += (cmd.buttons & keyboard::button::forward) ? add_x : -add_x;
z_ += (cmd.buttons & keyboard::button::forward) ? add_z : -add_z;
}
// handle action strafe left and strafe right
if ((cmd.buttons & keyboard::button::step_left) ||
(cmd.buttons & keyboard::button::step_right)) {
add_x = base_distance * std::cos(horz_angel_ - M_PI / 2);
add_z = base_distance * -std::sin(horz_angel_ - M_PI / 2);
x_ += (cmd.buttons & keyboard::button::step_right) ? add_x : -add_x;
z_ += (cmd.buttons & keyboard::button::step_right) ? add_z : -add_z;
}
// handle action move up
if ((cmd.buttons & keyboard::button::up))
y_ += base_distance;
// handle action move down
if ((cmd.buttons & keyboard::button::down))
y_ -= base_distance;
}
private:
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive& ar, const unsigned int version) {
ar & id_;
ar & color_;
ar & x_ & y_ & z_;
ar & horz_angel_ & vert_angel_;
ar & last_command_id_;
}
uint8_t id_;
uint32_t color_;
float x_, y_, z_;
float horz_angel_, vert_angel_;
int last_command_id_;
};
#endif // PLAYER_HPP_
|
Tom Coolen has coached a lot of teams in his 58 years.
His career has spanned seven countries and 25 years. He’s spent thousands of hours in rinks with teenagers in the Quebec Major Junior Hockey League, to grizzled pros in Europe.
And he knows how to win.
During the 1992-93 season, he led the Acadia University men’s hockey team to the Canadian Interuniversity Sport national championship at the storied Maple Leaf Gardens in Toronto.
But nothing compared to what he felt on Feb. 26 of this year.
On that day, Coolen helped lead the St. Thomas University men’s volleyball team to the Atlantic Colleges Athletic Association championship as co-coach.
STU was the underdog in the match against Holland College, as a team made up of mostly first-year players taking on the top-ranked team.
The team moved on to the Canadian Colleges Athletic Association national championships. They finished last in the tournament of eight teams last weekend, outmatched against squads from Ontario and Quebec.
But for a team that sat out last season due to a hazing suspension and had to rebuild from scratch, an ACAA championship was more than what anyone could have expected.
“With the team being [suspended], I looked at it that we were a new team and this was a fresh start. It was a new beginning to the program.
It was that attitude, along with his winning reputation, that brought a professional hockey coach to STU to co-coach a rookie team of volleyball players.
Coolen grew up in Halifax and played baseball in the Canada Games. After that, he went on to an Atlantic University Sport football career.
But hockey is the sport that has taken up much of his life.
With a desire to keep playing in some form, Coolen started his hockey coaching career as an assistant coach with the University of New Brunswick men’s hockey team, then called the Red Devils, in 1982-83.
Coaching took him all over the world, from the U.S. college circuit to Switzerland and Germany.
But his credentials go beyond the rink.
With master’s degrees in athletic coaching and counselling, Coolen is one of only two people in the province certified by the Canadian Sports Psychology Association.
He now splits his time scouting major junior games for NHL Central Scouting and teaching at a school in Doaktown, N.B.
Last fall, he met with STU athletics director Mike Eagles to talk about rebuilding the men’s volleyball program. Eagles was interested in seeing if Coolen’s son, Patrick, would play for STU.
He also wanted to see if Coolen would guide the team with rookie co-coach Francis Duguay.
“He felt I had a lot of success as a university coach. I think he felt that would be a good place to start.
“I was familiar with the volleyball, that age level of kids entering university because I had been involved with the under-18 team [as] general manager.
They decided Duguay would handle the on-court coaching and run practices, while Coolen would handle the administrative side and provide general guidance on things like how to handle players.
As the season wore on, Coolen helped focus and motivate the young team.
At Christmas, the team added Coolen’s son, Patrick, and veteran Andrew Keddy to the team. The libero and setter would be important keys to winning the championship, logging big minutes during the ACAA weekend.
In addition to having talent, Coolen knew the key to the team’s success would be taking the program seriously.
The week before the championship weekend, Coolen used his sports psychology training to help the team get ready physically and mentally for the challenge ahead of them, starting with practicing at 100 per cent every day. He believes you play how you practice.
Much of the roster can play at least another three years at STU if they want to, but Coolen isn’t sure he’ll be there to guide them next season.
“I came in to establish it and get it started.
|
Formal statement is: lemma cone_Union[intro]: "(\<forall>s\<in>f. cone s) \<longrightarrow> cone (\<Union>f)" Informal statement is: If every element of a set $f$ is a cone, then the union of $f$ is a cone.
|
module Day21
using Memoize
import ..data_dir # from parent module
input = read(joinpath(data_dir, "day21"), String)
export part1, part2
function parse_player(player_string::AbstractString)
numbers = [match.match for match in eachmatch(r"[[:digit:]]+", player_string)]
Player(parse.(Int64, numbers)...)
end
function parse_players(input::AbstractString)
player_strings = split(input, "\n", keepempty = false)
parse_player.(player_strings)
end
mutable struct Player
number::Int64
position::Int64
score::Int64
end
Player(number, position) = Player(number, position, 0)
Player(number) = Player(number, 0, 0)
new_position(position::Int64, movement::Int64) = mod(position + movement - 1, 10) + 1
function move!(player::Player, movement::Int64)
player.position = new_position(player.position, movement)
player.score += player.position
end
mutable struct DeterministicDice
sequence::Vector{Int64}
rolls::Int64
end
DeterministicDice(size::Int64) = DeterministicDice(collect(1:size), 0)
function roll!(dice::DeterministicDice)
if dice.rolls == length(dice.sequence)
dice.rolls = 0
end
dice.rolls += 1
return dice.sequence[dice.rolls]
end
function roll!(dice::DeterministicDice, times::Int64)
sum(roll!(dice) for i = 1:times)
end
function part1(input = input)
players = parse_players(input)
sort!(players, by = p -> p.number)
dice = DeterministicDice(100)
n_rolls = 0
while true
for player in players
move!(player, roll!(dice, 3))
n_rolls += 3
if player.score >= 1000
losing_player = first(filter(p -> p.number != player.number, players))
return losing_player.score * n_rolls
end
end
end
end
# enumerating the possible outcomes of rolling 3d3, the frequencies of each total:
const dice_sums = [(3, 1), (4, 3), (5, 6), (6, 7), (7, 6), (8, 3), (9, 1)]
# adapted from code by https://github.com/AxlLind
# https://github.com/AxlLind/AdventOfCode2021/blob/main/src/bin/21.rs
@memoize function dirac_dice_game(
this_player_position::Int64,
other_player_position::Int64,
this_player_score::Int64 = 0,
other_player_score::Int64 = 0
)
if other_player_score >= 21
return 0, 1 # other player wins
end
score = (0, 0)
for (roll, times) in dice_sums
this_player_new_position = new_position(this_player_position, roll)
this_player_new_score = this_player_score + this_player_new_position
# Note that the players alternate below
other_player_wins, this_player_wins = dirac_dice_game(
other_player_position,
this_player_new_position,
other_player_score,
this_player_new_score
)
score = score .+ times .* (this_player_wins, other_player_wins)
end
score
end
function part2(input = input)
players = parse_players(input)
sort!(players, by = p -> p.number)
wins = dirac_dice_game(players[1].position, players[2].position)
maximum(wins)
end
end #module
|
# install packages
# install.packages("tidyverse")
library(tidyverse)
# if (!requireNamespace("BiocManager", quietly = TRUE))
# install.packages("BiocManager")
# BiocManager::install("limma")
library(limma)
library(plotly)
library(htmlwidgets)
source("GSEAenricher.R")
top_tables <- list()
pea_tables <- list()
bubble_plots <- list()
run_dea_pea <- function(matrix_file, metadata_file, doe_file, index, save_path_dea, save_path_pea) {
matrixx <- readRDS(matrix_file)
metadata <- readRDS(metadata_file)
doe <- read_tsv(doe_file)
Gender <- factor(make.names(doe$Gender))
Age <- doe$AGE
Braak <- factor(make.names(doe$Braak.stage))
Batch <- factor(make.names(doe$Gel.Batch))
design <- model.matrix(~0+Gender+Age+Braak+Batch)
contrast <- makeContrasts(GenderComparison = GenderFemale - GenderMale, levels = design)
fit <- lmFit(matrixx, design)
# fit <- eBayes(fit)
fit2 <- contrasts.fit(fit, contrast)
fit2 <- eBayes (fit2)
# top <- topTable(fit, coef = "GenderComparison", adjust.method = "BH",n=Inf, sort.by = "P")
top2 <- topTable(fit2, coef = "GenderComparison", adjust.method = "BH",n=Inf, sort.by = "P")
# top <- merge(top, metadata, by=0, all=TRUE)
top2 <- merge(top2, metadata, by=0, all=TRUE)
top2$Shown.ID <- top2$hgnc_symbol
top2$Shown.ID[top2$Shown.ID==""] <- top2$Protein.IDs[top2$Shown.ID==""]
top2$setting <- index
top_tables[[index]] <<- top2
top2_sig <- top2 %>%
filter(P.Value <= 0.05)
print (summary(decideTests(fit,adjust.method = "BH", p.value = 0.05)))
print (summary(decideTests(fit,adjust.method = "none", p.value = 0.05)))
print (summary(decideTests(fit2,adjust.method = "BH", p.value = 0.05)))
print (summary(decideTests(fit2,adjust.method = "none", p.value = 0.05)))
# write.table(top2_sig, file='sig.tsv', quote=FALSE, sep='\t', col.names = NA)
load("gmt-go.Rdata")
g1 <- do_GSEA(top2, 1, gmt.go, group_name = "F_vs_M", Protein.ID.Column ="Protein.IDs")
g1$df$setting <- index
g1_filtered <- g1$df %>%
filter(pvalue < 0.05)
pea_tables[[index]] <<- g1
hcal_dea <- max ((length (unique (top2$Protein.IDs)) * 16.5 + 25 + 10 + 100), 500)
hcal_pea <- max ((length (unique (g1$df$ID)) * 16.5 + 25 + 10 + 100), 500)
#gp.pt <- ggplotly(p, tooltip = "text", height = hcal, source="DEAPlotSource") %>%
# layout (yaxis=(list(automargin = F)), margin=list (l=200))
# ggplot(top2_sig, aes(y=Protein.IDs, x=logFC)) +
# geom_point(aes(size=P.Value, color=AveExpr)) +
# labs(y="Protein IDs", x="logFC", color="Average expression", size="P-value") +
# theme(axis.text.x=element_text(angle=45, hjust=1), axis.text.y=element_text(size = 8, angle = 0, hjust = 1, face = "plain"))
p1 <- ggplot (data=top2_sig, aes (x=logFC, y=Protein.IDs)) +
geom_point(aes (size=AveExpr, fill=logFC, color=-log10(P.Value), stroke=0.5, text=paste('<b>Log fold change:</b>', logFC, '<br>',
'<b>Average expression:</b>', AveExpr,'<br>',
'<b>t-statistic:</b>', t,'<br>',
'<b>P-value:</b>',P.Value,'<br>',
'<b>Negative log10-P-value:</b>',-log10(P.Value),'<br>',
'<b>B-statistic:</b>',B,'<br>'))) +
scale_fill_gradient2(limits=c(-max(abs(top2_sig$logFC)), max(abs(top2_sig$logFC))), low = "#0199CC", mid = "white", high = "#FF3705", midpoint = 0) +
scale_color_gradient2(limits=c(0, max(abs(log10(top2_sig$P.Value)))), low = "white", mid = "white", high = "black", midpoint = 1) +
theme_minimal () + xlab("Comparison") + ylab("") +
theme(axis.text.x=element_text(angle=45, hjust=1), axis.text.y=element_text(size = 8, angle = 0, hjust = 1, face = "plain"))
gp.pt.1 <- ggplotly(p1, tooltip = "text", height = hcal_dea) %>%
layout (yaxis=(list(automargin = F)), margin=list (l=200))
saveWidget(gp.pt.1, save_path_dea)
# ggsave(save_path_dea)
# ggplot(g1_filtered, aes(y=ID, x=rank)) +
# geom_point(aes(size=pvalue, color=enrichmentScore)) +
# labs(y="Protein IDs", x="logFC", color="Enrichment score", size="P-value") +
# theme(axis.text.x=element_text(angle=45, hjust=1), axis.text.y=element_text(size = 8, angle = 0, hjust = 1, face = "plain"))
p2 <- ggplot (data=g1_filtered, aes (x=enrichmentScore, y=ID)) +
geom_point(aes (size=setSize, fill=NES, color=-log10(pvalue), stroke=0.5, text=paste('<b>Core_enrichment:</b>', core_enrichment, '<br>',
'<b>Comparison:</b>', Group,'<br>',
'<b>Setsize:</b>', setSize,'<br>',
'<b>NES:</b>',NES,'<br>',
'<b>pvalue:</b>',pvalue,'<br>',
'<b>rank:</b>',rank,'<br>',
'<b>leading_edge:</b>',leading_edge,'<br>'))) +
scale_fill_gradient2(limits=c(-max(abs(g1_filtered$NES)), max(abs(g1_filtered$NES))), low = "#0199CC", mid = "white", high = "#FF3705", midpoint = 0) +
scale_color_gradient2(limits=c(0, max(abs(log10(g1_filtered$pvalue)))), low = "white", mid = "white", high = "black", midpoint = 1) +
theme_minimal () + xlab("Comparison") + ylab("") +
theme(axis.text.x=element_text(angle=45, hjust=1), axis.text.y=element_text(size = 8, angle = 0, hjust = 1, face = "plain"))
gp.pt.2 <- ggplotly(p2, tooltip = "text", height = hcal_pea) %>%
layout (yaxis=(list(automargin = F)), margin=list (l=200))
saveWidget(gp.pt.2, save_path_pea)
# ggsave(save_path_pea)
}
run_dea_pea("pgdata_matrix_1.rds", "pgdata_metadata_1.rds", "manifest2.tsv", "filter_mindet", "dea_1.html", "pea_1.html")
run_dea_pea("pgdata_matrix_2.rds", "pgdata_metadata_2.rds", "manifest2.tsv", "filter_bpca", "dea_2.html", "pea_2.html")
run_dea_pea("pgdata_matrix_3.rds", "pgdata_metadata_3.rds", "manifest2.tsv", "nofilter_mindet", "dea_3.html", "pea_3.html")
run_dea_pea("pgdata_matrix_4.rds", "pgdata_metadata_4.rds", "manifest2.tsv", "nofilter_bpca", "dea_4.html", "pea_4.html")
# -------------------------
# process top tables
top2_all <- rbind(top_tables[["filter_mindet"]], top_tables[["filter_bpca"]], top_tables[["nofilter_mindet"]], top_tables[["nofilter_bpca"]])
# process ggplot
gp_all <- rbind(pea_tables[["filter_mindet"]]$df, pea_tables[["filter_bpca"]]$df, pea_tables[["nofilter_mindet"]]$df, pea_tables[["nofilter_bpca"]]$df)
hcal_dea <- max ((length (unique (top2_all$Protein.IDs)) * 16.5 + 25 + 10 + 100), 500)
hcal_pea <- max ((length (unique (gp_all$ID)) * 16.5 + 25 + 10 + 100), 500)
#gp.pt <- ggplotly(p, tooltip = "text", height = hcal, source="DEAPlotSource") %>%
# layout (yaxis=(list(automargin = F)), margin=list (l=200))
# ggplot(top2_sig, aes(y=Protein.IDs, x=logFC)) +
# geom_point(aes(size=P.Value, color=AveExpr)) +
# labs(y="Protein IDs", x="logFC", color="Average expression", size="P-value") +
# theme(axis.text.x=element_text(angle=45, hjust=1), axis.text.y=element_text(size = 8, angle = 0, hjust = 1, face = "plain"))
p1 <- ggplot (data=top2_all, aes (x=setting, y=Protein.IDs)) +
geom_point(aes (size=AveExpr, fill=logFC, color=-log10(P.Value), stroke=0.5, text=paste('<b>Log fold change:</b>', logFC, '<br>',
'<b>Average expression:</b>', AveExpr,'<br>',
'<b>t-statistic:</b>', t,'<br>',
'<b>P-value:</b>',P.Value,'<br>',
'<b>Negative log10-P-value:</b>',-log10(P.Value),'<br>',
'<b>B-statistic:</b>',B,'<br>'))) +
scale_fill_gradient2(limits=c(-max(abs(top2_sig$logFC)), max(abs(top2_sig$logFC))), low = "#0199CC", mid = "white", high = "#FF3705", midpoint = 0) +
scale_color_gradient2(limits=c(0, max(abs(log10(top2_sig$P.Value)))), low = "white", mid = "white", high = "black", midpoint = 1) +
theme_minimal () + xlab("Comparison") + ylab("") +
theme(axis.text.x=element_text(angle=45, hjust=1), axis.text.y=element_text(size = 8, angle = 0, hjust = 1, face = "plain"))
gp.pt.1 <- ggplotly(p1, tooltip = "text", height = hcal_dea) %>%
layout (yaxis=(list(automargin = F)), margin=list (l=200))
saveWidget(gp.pt.1, "dea_all.html")
# ggsave(save_path_dea)
# ggplot(g1_filtered, aes(y=ID, x=rank)) +
# geom_point(aes(size=pvalue, color=enrichmentScore)) +
# labs(y="Protein IDs", x="logFC", color="Enrichment score", size="P-value") +
# theme(axis.text.x=element_text(angle=45, hjust=1), axis.text.y=element_text(size = 8, angle = 0, hjust = 1, face = "plain"))
p2 <- ggplot (data=gp_all, aes (x=setting, y=ID, customdata=paste0 (gp_all$Pathway,"%sep%", gp_all$core_enrichment))) +
geom_point(aes (size=setSize, fill=NES, color=-log10(pvalue), stroke=0.5, text=paste('<b>Core_enrichment:</b>', core_enrichment, '<br>',
'<b>Comparison:</b>', Group,'<br>',
'<b>Setsize:</b>', setSize,'<br>',
'<b>NES:</b>',NES,'<br>',
'<b>pvalue:</b>',pvalue,'<br>',
'<b>rank:</b>',rank,'<br>',
'<b>leading_edge:</b>',leading_edge,'<br>'))) +
scale_fill_gradient2(limits=c(-max(abs(gp_all$NES)), max(abs(gp_all$NES))), low = "#0199CC", mid = "white", high = "#FF3705", midpoint = 0) +
scale_color_gradient2(limits=c(0, max(abs(log10(gp_all$pvalue)))), low = "white", mid = "white", high = "black", midpoint = 1) +
theme_minimal () + xlab("Comparison") + ylab("") +
theme(axis.text.x=element_text(angle=45, hjust=1), axis.text.y=element_text(size = 8, angle = 0, hjust = 1, face = "plain"))
gp.pt.2 <- ggplotly(p2, tooltip = "text", height = hcal_pea) %>%
layout (yaxis=(list(automargin = F)), margin=list (l=200))
saveWidget(gp.pt.2, "pea_all.html")
|
# Galaxy morphometry
Primarily, morphometrics can be used to address galaxy morphology. Different works use a non-parametric approach to measure a galaxy's shape characteristics. `Lotz et al. (2004)` characterize galaxies' Concentration, Asymmetry. Furthermore, `Ferrari et al. (2015)` include Shannon entropy (information entropy) to quantify pixel values distribution. More recently, `Rosa et al. (2018)` characterized a galaxy's morphology using the second moment of the gradient of the images through Gradient Pattern Analysis. One of the critical features of non-parametric morphology estimation is understanding how a given parameter can reliably separate elliptical and spiral galaxies. Each metric measures patterns and forms in the image. Concentration (C) measures how tightly pixels are distributed in the galaxy structure, Asymmetry (A) measures irregularity of the form of the galaxy's disk and bulge, Smoothness (S) measures the presence of the small structures in the galaxy's disk (star-forming regions), Entropy (H) is the measure of the heterogeneity of the pixel distribution and G2 analyses the asymmetric vector field (variation of flux intensity). When applied to an image with a clearly elliptical galaxy, usually, C will have high values, and A, S, H, and G2 will have low values. While in the case of a clearly spiral galaxy, it would be the opposite. Combining these values can provide a solid intuition of the class of unknown galaxies.
Besides using the morphometric parameters to study the actual physical
processes molding galaxies directly, they can also be used in Machine Learning (ML) methods
to discriminate ETGs from LTGs. `Barchi et al. (2020)` conducts a thorough
study of ML using the CASHG2 system as the primary input information and galaxy
Zoo 1, GZ1 `(LINTOTT et al., 2008; LINTOTT et al., 2011)` provides the "true" classification.
These are the main ingredients for the training step. Several ML algorithms
were tested: Decision Tree (DT); Support Vector Machine (SVM); and Multilayer
Perceptron (MLP). DT had a slightly better performance than the other
two, with an overall accuracy (OA) of 98.5%, when dealing only with bright galaxies.
When applying Deep Learning (DL) technique, they find only a tiny increase
in OA, 99.5%.
CyMorph can also be applied to:
- X-Ray map tracing gas from the ICM. By combining the results of the galaxy's morphology and ICM hot gas X-Ray morphology properties, we plan to investigate how the cluster's ICM morphological properties (high asymmetry, for example) affect member galaxies' morphology.
- Trace galaxy properties typical for $\gamma$-ray burst(GRB) hosts to prioritize targets with similar characteristics during gravitational wave optical follow-ups `(Santana-Silva et al. (in prep.)`.
In summary, CyMorph can extract five different metrics: Concentration (C), Asymmetry (A), Smoothness (S), Entropy (H), and Gradient Pattern Analysis (G2). Each of these metrics (except G2) ranges from 0 (min) to 1 (max) depending on the particular features of the content of the image. These metrics have a wide range of application in further resurch.
## Metrics
### Concentration
Concentration is straightforward to grasp intuitively; it simply measures how the flux is distributed on the galaxy profile, that is concentrated in the center (bulge) of the galaxy or distributed around the whole profile. The practical process to perform this kind of measurement consists of several steps. Literature has different approaches to calculate concentration `(BERSHADY et al., 2000; GRAHAM et al., 2001b; ABRAHAM et al., 1994).`. Here we fallow the method proposed in `Conselice (2003) and Lotz et al. (2004)`.
Figure 1 is showing the $R_p$ and $2*R_p$ (left panel) and $\eta$ profile (left panel) of a spiral galaxy
<figure>
</figure>
<center><i>Figure 1</i></center>
By definition, Concentration stands for a ratio of two portions of accumulated flux in two different fractions of the total flux of a galaxy. It is defined by: $C = log_{10}(R_1/R_2)$, where $R_1$ and $R_2$ are the fractions of the total flux. They also called the outer and inner radii enclosing a fraction of total flux. The values of $R_1$ and $R_2$ can vary arbitrary, in range of 100 to 0 (containing all flux and none of it). Several studies used different pairs of $R_1$ and $R_2$ `(LOTZ et al., 2004; FERRARI et al., 2015)`.
Panel A in Figure 2 shows the accumulated flux curve for the elliptical galaxy, panel B for the spiral galaxy. From the comparison, it could be seen that flux growth in the case of the elliptical galaxy slows considerably already at $R_2$, resulting in the highly concentrated center of this galaxy. In the case of a spiral galaxy, the accumulated flux keeps increasing more uniformly even after $R_2$.
<figure>
</figure>
<center><i>Figure 2</i></center>
The processing starts by calculating the accumulated flux intensity curve and $\eta$ profile on the cleaned image. Galaxies are resolved objects with poorly defined edges and do not all have the same radial surface brightness profile; some care is required to define the flux associated with each object. The $\eta$ profile is necessary to obtain the Petrosian radius ($R_p$) because the total flux of a galaxy is defined by the accumulated flux until $2*R_p$. The aperture $2*R_p$ is large enough to contain nearly all the flux for typical galaxy profiles but small enough that the sky noise impact is negligible `Blanton et al. (2001)`. Based on the $\eta$ profile, it is also largely insensitive to variations in the limiting surface brightness and redshift (in the sense of distance), providing reliable results for the galaxies with a high signal-to-noise ratio.
We follow `Blanton et al. (2001)` and `Strateva et al. (2001)` and set $R_p$ on $\eta = 0.2$ as it is shown in the right panel in Figure 1. The left panel in Figure 1 shows the portions in $R_p$ and $2*R_p$. Finally, it becomes possible to set the radii that contain the fractions of total flux. Intuitively and as it could be seen in the Figure 2, elliptical galaxies have the flux concentrated in the center, and it falls almost entirely in the R2 radius, leaving R1 with almost equal to R2 and pushing the ratio up. The opposite occurs with spiral galaxies, the main portion of the flux is concentrated in the center, but the spiral arms increase the total flux located in R2 and drive the ratio down.
### Asymmetry
Asymmetry could be the most uncomplicated metric to extract, and the simplicity consists in the fact that it is not necessary to perform any additional operation on the $segmented\_image$. Tracing the asymmetry distribution in the galaxy profile can help to reveal dynamic processes in galaxies. This is especially true when we talk about collisionless stars and can track the matter distribution more precisely. For instance, galaxies disturbed by interactions or mergers with another galaxy will tend to have high asymmetries `(CONSELICE et al., 2000)`.
Asymmetry, by definition, measures the degree of irregularity of the galaxy profile. To obtain it, CyMorph will rotate the segmented image by $180^{\circ}$ and run a $for$ loop on both of the images (segmented and rotated). This loop will compare each $[i,j]$ pixel of both of the images, and in case if both are not zero (containing flux counts), the non-zero pixels will be stored in $list1$ and $list2$—these lists of pixels for segmented and rotated images, respectively.
Figure 3 is showing how does correlation works when we collect the pixels on input (Panel A) and rotated (Panel B) images. Panel C shows the visual correlation of $list1$ and $list2$, rotated and original pixels respectively.
<figure>
</figure>
<center><i>Figure 3</i></center>
The next step would be the calculation of the correlation coefficient between the segmented image and the rotated image pixels lists. CyMorph will use Pearson and Spearman Ranks `(PRESS,2005)` coefficient functions to calculate the correlation coefficients between the two lists. In the case of an elliptical galaxy, the correlation coefficient will be high since the pixels of the elliptical galaxy are fairly heterogeneously distributed. In the case of a spiral galaxy, where pixels have a much higher gradient, it will mean that, after rotation, two pixels on the same position will have very different values.
The formula to calculate A is $A = 1 - spearmanr(list1, list2)$. When the correlation coefficient is high (meaning that there is no significant difference between pixel values on both images), asymmetry will be low (case of an elliptical galaxy). In case if the correlation coefficient is low, the asymmetry will be high (case of spiral galaxy).
As it could be seen in Figure 3, if one rotates a spiral galaxy, the correlation would be low since spiral arms and similar irregularities will contribute to the fact that the same pixels would have very different flux values. It would be the opposite if we rotated the elliptical one. The reason is that elliptical galaxies have nearly perfect flux distribution. So the correlation will be high.
### Smoothness
Smoothness (or clumpiness) is calculated very similarly with asymmetry. It calculates the Pearson and Spearman ranks correlation coefficients between the segmented image and its smoothed version `(ABRAHAM et al., 1996; CONSELICE, 2003; FERRARI et al., 2015)`. Instead of rotation, we are applying a second order of the Butter filter to smooth the original image. This filter provides the advantage of continuous adaptive control of the smoothing degree applied to the image `(KASZYNSKI; PISKOROWSKI, 2006; PEDRINI; SCHWARTZ, 2008; SAUTTER, 2018)`. By intuition, if one tries to smooth the elliptical galaxy, the result will be almost the same image because naturally, these galaxies are smooth. Scanning the images, storing the pixels to lists, and calculating the coefficient will result in a high correlation between the segmented and smoothed image. Spiral galaxies will produce the opposite result, for the correlation will be low between the images, and clumpiness will be high. The formula to obtain S is $S = 1 - spearmanr(list1, list2)$.
The nomenclature could bring confusion, but the logic behind this metric consists in the fact that spiral galaxies will present small structures inside the disk that will contribute to the high Clumpiness values, while elliptical galaxies, naturally smooth, will have high correlation and low Clumpiness value.
From Figure 4 we can see that smoothing the spiral galaxy produces a significant difference. In the case of an elliptical galaxy, it would be almost unnoticeable. The level of change in the image after the smoothing is the key factor in the metric calculation. Figure 4 is showing how does correlation works when we collect the pixels on input and smoothed image. Panel C is showing the visual correlation of $list1$ and $list2$, rotated and original pixels respectively.
<figure>
</figure>
<center><i>Figure 4</i></center>
### Entropy
Entropy (H) works very similarly to the concentration in the sense that it measures pixel density/frequency in a given number of bins. Entropy bins number is a parameter that can be tuned to adapt better to the data at hand, and it is responsible for how many bins the flux distribution will be split. In a simplified manner, H measures the distribution of pixel values in the image by dividing the image in an arbitrary number of bins. The process of the H extraction does not have any additional image manipulation. The input image pixels are raveled (converted to 1d array) and are used to calculate values of the histogram (frequency of the flux) and bin edges with $numpy.histogram$. The illustration of this process is shown in Figure 5.
It is worth noting how the flux of the elliptical galaxy is concentrated in a small area, while the spiral galaxy's flux occupies a broader area of flux distribution. The next step is the normalization of the frequency counts by maximum count and then calculating the entropy value with:
\begin{equation}
H(I)=-\sum_{k}^{K} p\left(I_{k}\right) \log \left[p\left(I_{k}\right)\right]
\end{equation}
<center><i>Equation 1</i></center>
where:
- $p(I_{k})$ - s the probability of occurrence of the value $I_{k}$
- $K$ - number of bins that data was split
For discrete variables, $H$ reaches the maximum value for a uniform distribution, when $p(I_{k}) = 1/K$ for all $k$, resulting in $H_{max} = \log K$. The minimum entropy is that of a delta function, for which $H = 0$. Hence, we can get the normalized entropy with:
\begin{equation}
\widetilde{H}(I)=\frac{H(I)}{H_{\max }} \quad 0 \leqslant \widetilde{H}(I) \leqslant 1
\end{equation}
<center><i>Equation 2</i></center>
Elliptical galaxies are expected to have low entropy (for having natural homogeneity of flux (pixel value) distribution), and spiral galaxies are expected to have high values of entropy (by presenting irregular structures and those having pixel value heterogeneity naturally) `(BISHIP, 2007; FERRARI et al., 2015)`.
The top row in the Figure 5 shows the flux distribution of an elliptical galaxy when the image is raveled and used as input for the $numpy.histogram$. The thin distribution limited to low counts with a fast decrease slope characterizes the flux concentration of the elliptical profile. We can see the opposite in the case of a spiral galaxy (middle row), where the flux is spread over a bigger area of the flux axis.
<figure>
</figure>
<center><i>Figure 5</i></center>
### Gradient Pattern Analysis (second moment)
The second moment of Gradient Pattern Analysis (GPA), in short G2, can be considered the most complex metric to be calculated. According to `Sautter (2018)`, GPA has four moments, but for the galaxy morphology classification, only the first and second are currently used. `Rosa et al. (2018)` showed that improved and revised version of the second moment (with due modifications) shows best results in galaxy separations when compared with classic CAS classification `(CONSELICE, 2003)`. We have performed a revision and optimization of the code to comply with the original definition.
#### Extraction process
The first step is to convert all zeros in the image to $numpy.nan$. This condition assures that the border pixels of the image will be ignored during the gradient field generation. Otherwise, they would contribute detrimentally to the final result. Then we are generating the gradient field with $numpy.gradient(segmented\_image)$.
In the next step, we will generate an asymmetric gradient field. This process consists of locating pairs of pixels located at the same distance from the center and comparing modulus (strength) and phase (direction) between them. If two pixels of the given pair have the same modulus but opposite phases, they will be considered symmetric and removed. This process will be performed on all the unique pairs of pixels (to exclude the repetition). The resulting lattice is called an asymmetry vector field because all symmetric pairs are removed. Next, we will obtain the count of asymmetric vectors, their sum, and their modulus sum. To determine if the vectors are aligned and have the same magnitude, we need to calculate $confluence$ using the equation 3:
\begin{equation}
confluence = \left(\frac{\left|\sum_{i}^{V_{a}} v_{a}^{i}\right|}{\sum_{i}^{V_{a}}\left|v_{a}^{i}\right|}\right)
\end{equation}
<center><i>Equation 3</i></center>
where:
- $v_{a}$ - list of asymmetrical vectors
- $V_{A}$ - count of asymmetric vectors
The final calculation of G2 value is obtained by the equation 4 `(ROSA et al., 1999;
RAMOS et al., 2000; ROSA et al., 2003; SAUTTER, 2018)`:
\begin{equation}
G_{2} = \frac{V_{A}} {V - V_{c}} (2-confluence)
\end{equation}
<center><i>Equation 4</i></center>
where:
- $V_{A}$ - total valid pixels
- $V_{c}$ - contour pixels
- $V_{A}$ - asymmetric pixels
- $2$ - normalization factor
Figure 6 shows results in two fringe cases: random noise, resulting in maximum G2 value (as there are very few pairs that end up canceled) and Gaussian noise, resulting in minimum G2 value (as there are all pixel pairs end up canceled).
<figure>
</figure>
<center><i>Figure 6</i></center>
It is possible to perform fine-tuning of the G2. It has two tolerances: $modulus\_tolerance$. $modulus\_tolerance$ is responsible for serving as the threshold of the minimum acceptable strength difference between two vectors. Worth noting that modulus are normalized by the maximum value during the calculation, so the $modulus\_tolerance$ can be influential even with low values, as it ranges from 0 (no tolerance at all) to 1 (any two pixels are considered to have same modulus). $phase\_tolerance$ serves as a threshold of minimal acceptable angle difference between two pixels (their vectors). It ranges from 0 (no tolerance) to 3.14 (any any two pixels are considered to have same angle)
The top row in Figure 6 shows the results expected with a simulated input image with Gaussian noise. In this case, almost all the vectors should cancel out, the asymmetric gradient field should be empty, and the resulting value of G2 should be near to 0 (minimum value of G2). The bottom row shows the results expected with a simulated input image with random noise. In this case, almost all the vectors will be preserved, and the resulting value of G2 should be near to 2.0 (maximum value of G2).
Intuitively, elliptical galaxies will have a lot of the same vectors, being naturally smooth and round, and as a consequence, many vectors will be canceled. In the case of spiral galaxies, the internal structures distort the gradient field, resulting in many vectors being preserved. Figure 7 shows visualization of this behavior.
The top row shows the results expected with elliptical galaxies. Generally, most of the vectors should cancel out, resulting in a low value of G2 ($G2 < 0.5$). The bottom row shows the results expected with spiral galaxies. In this case, most of the vectors will be preserved, and the resulting value of G2 should be high ($G2 > 1.5$).
<figure>
</figure>
<center><i>Figure 7</i></center>
|
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content/blob/master/tutorials/W1D5_DimensionalityReduction/student/W1D5_Tutorial1.ipynb" target="_parent"></a>
# Neuromatch Academy: Week 1, Day 5, Tutorial 1
# Dimensionality Reduction: Geometric view of data
__Content creators:__ Alex Cayco Gajic, John Murray
__Content reviewers:__ Roozbeh Farhoudi, Matt Krause, Spiros Chavlis, Richard Gao, Michael Waskom
---
# Tutorial Objectives
In this notebook we'll explore how multivariate data can be represented in different orthonormal bases. This will help us build intuition that will be helpful in understanding PCA in the following tutorial.
Overview:
- Generate correlated multivariate data.
- Define an arbitrary orthonormal basis.
- Project the data onto the new basis.
```python
# @title Video 1: Geometric view of data
from IPython.display import IFrame
class BiliVideo(IFrame):
def __init__(self, id, page=1, width=400, height=300, **kwargs):
self.id=id
src = "https://player.bilibili.com/player.html?bvid={0}&page={1}".format(id, page)
super(BiliVideo, self).__init__(src, width, height, **kwargs)
video = BiliVideo(id='BV1Af4y1R78w', width=854, height=480, fs=1)
print("Video available at https://www.bilibili.com/video/{0}".format(video.id))
video
```
Video available at https://www.bilibili.com/video/BV1Af4y1R78w
---
# Setup
```python
# Import
import numpy as np
import matplotlib.pyplot as plt
```
```python
# @title Figure Settings
import ipywidgets as widgets # interactive display
%config InlineBackend.figure_format = 'retina'
plt.style.use("/share/dataset/COMMON/nma.mplstyle.txt")
```
```python
# @title Helper functions
def get_data(cov_matrix):
"""
Returns a matrix of 1000 samples from a bivariate, zero-mean Gaussian.
Note that samples are sorted in ascending order for the first random variable
Args:
cov_matrix (numpy array of floats): desired covariance matrix
Returns:
(numpy array of floats) : samples from the bivariate Gaussian, with each
column corresponding to a different random
variable
"""
mean = np.array([0, 0])
X = np.random.multivariate_normal(mean, cov_matrix, size=1000)
indices_for_sorting = np.argsort(X[:, 0])
X = X[indices_for_sorting, :]
return X
def plot_data(X):
"""
Plots bivariate data. Includes a plot of each random variable, and a scatter
plot of their joint activity. The title indicates the sample correlation
calculated from the data.
Args:
X (numpy array of floats) : Data matrix each column corresponds to a
different random variable
Returns:
Nothing.
"""
fig = plt.figure(figsize=[8, 4])
gs = fig.add_gridspec(2, 2)
ax1 = fig.add_subplot(gs[0, 0])
ax1.plot(X[:, 0], color='k')
plt.ylabel('Neuron 1')
plt.title('Sample var 1: {:.1f}'.format(np.var(X[:, 0])))
ax1.set_xticklabels([])
ax2 = fig.add_subplot(gs[1, 0])
ax2.plot(X[:, 1], color='k')
plt.xlabel('Sample Number')
plt.ylabel('Neuron 2')
plt.title('Sample var 2: {:.1f}'.format(np.var(X[:, 1])))
ax3 = fig.add_subplot(gs[:, 1])
ax3.plot(X[:, 0], X[:, 1], '.', markerfacecolor=[.5, .5, .5],
markeredgewidth=0)
ax3.axis('equal')
plt.xlabel('Neuron 1 activity')
plt.ylabel('Neuron 2 activity')
plt.title('Sample corr: {:.1f}'.format(np.corrcoef(X[:, 0], X[:, 1])[0, 1]))
plt.show()
def plot_basis_vectors(X, W):
"""
Plots bivariate data as well as new basis vectors.
Args:
X (numpy array of floats) : Data matrix each column corresponds to a
different random variable
W (numpy array of floats) : Square matrix representing new orthonormal
basis each column represents a basis vector
Returns:
Nothing.
"""
plt.figure(figsize=[4, 4])
plt.plot(X[:, 0], X[:, 1], '.', color=[.5, .5, .5], label='Data')
plt.axis('equal')
plt.xlabel('Neuron 1 activity')
plt.ylabel('Neuron 2 activity')
plt.plot([0, W[0, 0]], [0, W[1, 0]], color='r', linewidth=3,
label='Basis vector 1')
plt.plot([0, W[0, 1]], [0, W[1, 1]], color='b', linewidth=3,
label='Basis vector 2')
plt.legend()
plt.show()
def plot_data_new_basis(Y):
"""
Plots bivariate data after transformation to new bases.
Similar to plot_data but with colors corresponding to projections onto
basis 1 (red) and basis 2 (blue). The title indicates the sample correlation
calculated from the data.
Note that samples are re-sorted in ascending order for the first
random variable.
Args:
Y (numpy array of floats): Data matrix in new basis each column
corresponds to a different random variable
Returns:
Nothing.
"""
fig = plt.figure(figsize=[8, 4])
gs = fig.add_gridspec(2, 2)
ax1 = fig.add_subplot(gs[0, 0])
ax1.plot(Y[:, 0], 'r')
plt.xlabel
plt.ylabel('Projection \n basis vector 1')
plt.title('Sample var 1: {:.1f}'.format(np.var(Y[:, 0])))
ax1.set_xticklabels([])
ax2 = fig.add_subplot(gs[1, 0])
ax2.plot(Y[:, 1], 'b')
plt.xlabel('Sample number')
plt.ylabel('Projection \n basis vector 2')
plt.title('Sample var 2: {:.1f}'.format(np.var(Y[:, 1])))
ax3 = fig.add_subplot(gs[:, 1])
ax3.plot(Y[:, 0], Y[:, 1], '.', color=[.5, .5, .5])
ax3.axis('equal')
plt.xlabel('Projection basis vector 1')
plt.ylabel('Projection basis vector 2')
plt.title('Sample corr: {:.1f}'.format(np.corrcoef(Y[:, 0], Y[:, 1])[0, 1]))
plt.show()
```
---
# Section 1: Generate correlated multivariate data
```python
# @title Video 2: Multivariate data
from IPython.display import IFrame
class BiliVideo(IFrame):
def __init__(self, id, page=1, width=400, height=300, **kwargs):
self.id=id
src = "https://player.bilibili.com/player.html?bvid={0}&page={1}".format(id, page)
super(BiliVideo, self).__init__(src, width, height, **kwargs)
video = BiliVideo(id='BV1xz4y1D7ES', width=854, height=480, fs=1)
print("Video available at https://www.bilibili.com/video/{0}".format(video.id))
video
```
Video available at https://www.bilibili.com/video/BV1xz4y1D7ES
To gain intuition, we will first use a simple model to generate multivariate data. Specifically, we will draw random samples from a *bivariate normal distribution*. This is an extension of the one-dimensional normal distribution to two dimensions, in which each $x_i$ is marginally normal with mean $\mu_i$ and variance $\sigma_i^2$:
\begin{align}
x_i \sim \mathcal{N}(\mu_i,\sigma_i^2).
\end{align}
Additionally, the joint distribution for $x_1$ and $x_2$ has a specified correlation coefficient $\rho$. Recall that the correlation coefficient is a normalized version of the covariance, and ranges between -1 and +1:
\begin{align}
\rho = \frac{\text{cov}(x_1,x_2)}{\sqrt{\sigma_1^2 \sigma_2^2}}.
\end{align}
For simplicity, we will assume that the mean of each variable has already been subtracted, so that $\mu_i=0$. The remaining parameters can be summarized in the covariance matrix, which for two dimensions has the following form:
\begin{equation*}
{\bf \Sigma} =
\begin{pmatrix}
\text{var}(x_1) & \text{cov}(x_1,x_2) \\
\text{cov}(x_1,x_2) &\text{var}(x_2)
\end{pmatrix}.
\end{equation*}
In general, $\bf \Sigma$ is a symmetric matrix with the variances $\text{var}(x_i) = \sigma_i^2$ on the diagonal, and the covariances on the off-diagonal. Later, we will see that the covariance matrix plays a key role in PCA.
## Exercise 1: Draw samples from a distribution
We have provided code to draw random samples from a zero-mean bivariate normal distribution. Throughout this tutorial, we'll imagine these samples represent the activity (firing rates) of two recorded neurons on different trials. Fill in the function below to calculate the covariance matrix given the desired variances and correlation coefficient. The covariance can be found by rearranging the equation above:
\begin{align}
\text{cov}(x_1,x_2) = \rho \sqrt{\sigma_1^2 \sigma_2^2}.
\end{align}
Use these functions to generate and plot data while varying the parameters. You should get a feel for how changing the correlation coefficient affects the geometry of the simulated data.
**Steps**
* Fill in the function `calculate_cov_matrix` to calculate the desired covariance.
* Generate and plot the data for $\sigma_1^2 =1$, $\sigma_1^2 =1$, and $\rho = .8$. Try plotting the data for different values of the correlation coefficent: $\rho = -1, -.5, 0, .5, 1$.
```python
help(plot_data)
help(get_data)
```
Help on function plot_data in module __main__:
plot_data(X)
Plots bivariate data. Includes a plot of each random variable, and a scatter
plot of their joint activity. The title indicates the sample correlation
calculated from the data.
Args:
X (numpy array of floats) : Data matrix each column corresponds to a
different random variable
Returns:
Nothing.
Help on function get_data in module __main__:
get_data(cov_matrix)
Returns a matrix of 1000 samples from a bivariate, zero-mean Gaussian.
Note that samples are sorted in ascending order for the first random variable
Args:
cov_matrix (numpy array of floats): desired covariance matrix
Returns:
(numpy array of floats) : samples from the bivariate Gaussian, with each
column corresponding to a different random
variable
```python
def calculate_cov_matrix(var_1, var_2, corr_coef):
"""
Calculates the covariance matrix based on the variances and correlation
coefficient.
Args:
var_1 (scalar) : variance of the first random variable
var_2 (scalar) : variance of the second random variable
corr_coef (scalar) : correlation coefficient
Returns:
(numpy array of floats) : covariance matrix
"""
#################################################
## TODO for students: calculate the covariance matrix
# Fill out function and remove
raise NotImplementedError("Student excercise: calculate the covariance matrix!")
#################################################
# Calculate the covariance from the variances and correlation
cov = ...
cov_matrix = np.array([[var_1, cov], [cov, var_2]])
return cov_matrix
###################################################################
## TO DO for students: generate and plot bivariate Gaussian data with variances of 1
## and a correlation coefficients of: 0.8
## repeat while varying the correlation coefficient from -1 to 1
###################################################################
np.random.seed(2020) # set random seed
variance_1 = 1
variance_2 = 1
corr_coef = 0.8
# Uncomment to test your code and plot
# cov_matrix = calculate_cov_matrix(variance_1, variance_2, corr_coef)
# X = get_data(cov_matrix)
# plot_data(X)
```
[*Click for solution*](https://github.com/erlichlab/course-content/tree/master//tutorials/W1D5_DimensionalityReduction/solutions/W1D5_Tutorial1_Solution_57497711.py)
*Example output:*
---
# Section 2: Define a new orthonormal basis
```python
# @title Video 3: Orthonormal bases
from IPython.display import IFrame
class BiliVideo(IFrame):
def __init__(self, id, page=1, width=400, height=300, **kwargs):
self.id=id
src = "https://player.bilibili.com/player.html?bvid={0}&page={1}".format(id, page)
super(BiliVideo, self).__init__(src, width, height, **kwargs)
video = BiliVideo(id='BV1wT4y1E71g', width=854, height=480, fs=1)
print("Video available at https://www.bilibili.com/video/{0}".format(video.id))
video
```
Video available at https://www.bilibili.com/video/BV1wT4y1E71g
Next, we will define a new orthonormal basis of vectors ${\bf u} = [u_1,u_2]$ and ${\bf w} = [w_1,w_2]$. As we learned in the video, two vectors are orthonormal if:
1. They are orthogonal (i.e., their dot product is zero):
\begin{equation}
{\bf u\cdot w} = u_1 w_1 + u_2 w_2 = 0
\end{equation}
2. They have unit length:
\begin{equation}
||{\bf u} || = ||{\bf w} || = 1
\end{equation}
In two dimensions, it is easy to make an arbitrary orthonormal basis. All we need is a random vector ${\bf u}$, which we have normalized. If we now define the second basis vector to be ${\bf w} = [-u_2,u_1]$, we can check that both conditions are satisfied:
\begin{equation}
{\bf u\cdot w} = - u_1 u_2 + u_2 u_1 = 0
\end{equation}
and
\begin{equation}
{|| {\bf w} ||} = \sqrt{(-u_2)^2 + u_1^2} = \sqrt{u_1^2 + u_2^2} = 1,
\end{equation}
where we used the fact that ${\bf u}$ is normalized. So, with an arbitrary input vector, we can define an orthonormal basis, which we will write in matrix by stacking the basis vectors horizontally:
\begin{equation}
{{\bf W} } =
\begin{pmatrix}
u_1 & w_1 \\
u_2 & w_2
\end{pmatrix}.
\end{equation}
## Exercise 2: Find an orthonormal basis
In this exercise you will fill in the function below to define an orthonormal basis, given a single arbitrary 2-dimensional vector as an input.
**Steps**
* Modify the function `define_orthonormal_basis` to first normalize the first basis vector $\bf u$.
* Then complete the function by finding a basis vector $\bf w$ that is orthogonal to $\bf u$.
* Test the function using initial basis vector ${\bf u} = [3,1]$. Plot the resulting basis vectors on top of the data scatter plot using the function `plot_basis_vectors`. (For the data, use $\sigma_1^2 =1$, $\sigma_2^2 =1$, and $\rho = .8$).
```python
help(plot_basis_vectors)
```
Help on function plot_basis_vectors in module __main__:
plot_basis_vectors(X, W)
Plots bivariate data as well as new basis vectors.
Args:
X (numpy array of floats) : Data matrix each column corresponds to a
different random variable
W (numpy array of floats) : Square matrix representing new orthonormal
basis each column represents a basis vector
Returns:
Nothing.
```python
def define_orthonormal_basis(u):
"""
Calculates an orthonormal basis given an arbitrary vector u.
Args:
u (numpy array of floats) : arbitrary 2-dimensional vector used for new
basis
Returns:
(numpy array of floats) : new orthonormal basis
columns correspond to basis vectors
"""
#################################################
## TODO for students: calculate the orthonormal basis
# Fill out function and remove
raise NotImplementedError("Student excercise: implement the orthonormal basis function")
#################################################
# normalize vector u
u = ...
# calculate vector w that is orthogonal to w
w = ...
W = np.column_stack([u, w])
return W
np.random.seed(2020) # set random seed
variance_1 = 1
variance_2 = 1
corr_coef = 0.8
cov_matrix = calculate_cov_matrix(variance_1, variance_2, corr_coef)
X = get_data(cov_matrix)
u = np.array([3, 1])
# Uncomment and run below to plot the basis vectors
# W = define_orthonormal_basis(u)
# plot_basis_vectors(X, W)
```
[*Click for solution*](https://github.com/erlichlab/course-content/tree/master//tutorials/W1D5_DimensionalityReduction/solutions/W1D5_Tutorial1_Solution_7a9640ef.py)
*Example output:*
---
# Section 3: Project data onto new basis
```python
# @title Video 4: Change of basis
from IPython.display import IFrame
class BiliVideo(IFrame):
def __init__(self, id, page=1, width=400, height=300, **kwargs):
self.id=id
src = "https://player.bilibili.com/player.html?bvid={0}&page={1}".format(id, page)
super(BiliVideo, self).__init__(src, width, height, **kwargs)
video = BiliVideo(id='BV1LK411J7NQ', width=854, height=480, fs=1)
print("Video available at https://www.bilibili.com/video/{0}".format(video.id))
video
```
Video available at https://www.bilibili.com/video/BV1LK411J7NQ
Finally, we will express our data in the new basis that we have just found. Since $\bf W$ is orthonormal, we can project the data into our new basis using simple matrix multiplication :
\begin{equation}
{\bf Y = X W}.
\end{equation}
We will explore the geometry of the transformed data $\bf Y$ as we vary the choice of basis.
## Exercise 3: Define an orthonormal basis
In this exercise you will fill in the function below to define an orthonormal basis, given a single arbitrary vector as an input.
**Steps**
* Complete the function `change_of_basis` to project the data onto the new basis.
* Plot the projected data using the function `plot_data_new_basis`.
* What happens to the correlation coefficient in the new basis? Does it increase or decrease?
* What happens to variance?
```python
def change_of_basis(X, W):
"""
Projects data onto new basis W.
Args:
X (numpy array of floats) : Data matrix each column corresponding to a
different random variable
W (numpy array of floats) : new orthonormal basis columns correspond to
basis vectors
Returns:
(numpy array of floats) : Data matrix expressed in new basis
"""
#################################################
## TODO for students: project the data onto o new basis W
# Fill out function and remove
raise NotImplementedError("Student excercise: implement change of basis")
#################################################
# project data onto new basis described by W
Y = ...
return Y
# Unomment below to transform the data by projecting it into the new basis
# Y = change_of_basis(X, W)
# plot_data_new_basis(Y)
```
[*Click for solution*](https://github.com/erlichlab/course-content/tree/master//tutorials/W1D5_DimensionalityReduction/solutions/W1D5_Tutorial1_Solution_a1124bbc.py)
*Example output:*
## Interactive Demo: Play with the basis vectors
To see what happens to the correlation as we change the basis vectors, run the cell below. The parameter $\theta$ controls the angle of $\bf u$ in degrees. Use the slider to rotate the basis vectors.
```python
# @title
# @markdown Make sure you execute this cell to enable the widget!
def refresh(theta=0):
u = [1, np.tan(theta * np.pi / 180)]
W = define_orthonormal_basis(u)
Y = change_of_basis(X, W)
plot_basis_vectors(X, W)
plot_data_new_basis(Y)
_ = widgets.interact(refresh, theta=(0, 90, 5))
```
## Questions
* What happens to the projected data as you rotate the basis?
* How does the correlation coefficient change? How does the variance of the projection onto each basis vector change?
* Are you able to find a basis in which the projected data is **uncorrelated**?
---
# Summary
- In this tutorial, we learned that multivariate data can be visualized as a cloud of points in a high-dimensional vector space. The geometry of this cloud is shaped by the covariance matrix.
- Multivariate data can be represented in a new orthonormal basis using the dot product. These new basis vectors correspond to specific mixtures of the original variables - for example, in neuroscience, they could represent different ratios of activation across a population of neurons.
- The projected data (after transforming into the new basis) will generally have a different geometry from the original data. In particular, taking basis vectors that are aligned with the spread of cloud of points decorrelates the data.
* These concepts - covariance, projections, and orthonormal bases - are key for understanding PCA, which we be our focus in the next tutorial.
|
!
! FNote: Command-line notebook application
! Module: Main program, with helper procedures for command-line argument
! handling.
!
program main
use fnote
use note_mod
implicit none
integer, parameter :: NEWNOTE = 1
integer, parameter :: LISTNOTES = 2
integer, parameter :: REMOVENOTE = 3
integer, parameter :: INVALID_CMD = 0
integer :: arg_num
character(len=:), allocatable :: arg_txt
integer :: cmdcode
type(note_t) :: note
integer :: unum
integer :: rstat
integer :: note_num
unum = open_file('r')
call read_notes(unum)
call close_file(unum)
arg_num = command_argument_count()
! Get command-line argument, result --> arg_txt.
call get_arg(1, arg_txt)
! Read argument string for command.
cmdcode = parse_cmd(arg_num, arg_txt)
call dealloc_arg(arg_txt)
! Execute operation.
select case (cmdcode)
case (NEWNOTE)
call get_arg(2, arg_txt)
note = note_t(id_num=find_free_idnum(), msg=arg_txt)
call dealloc_arg(arg_txt)
unum = open_file('a')
call add_note(unum, note)
call close_file(unum)
case (LISTNOTES)
call list_notes()
case (REMOVENOTE)
call get_arg(2, arg_txt)
read(unit=arg_txt, fmt='(i4)',iostat=rstat) note_num
if (rstat == 0) then
call remove_note(note_num)
else
call usage('invalid ID number: "' // arg_txt // '".')
end if
case default
call say_hello()
call usage()
end select
call dealloc_arg(arg_txt)
call clean_notes()
contains
!
! name: parse_cmd
! desc: Helper function for parsing command-line argument.
! @param numargs: number of cmd-line arguments.
! @param str: cmd-line parameters as a character string.
! @return: the command code as an integer number.
!
function parse_cmd(numargs, str) result(cmdcode)
integer, intent(in) :: numargs
character(len=:), allocatable, intent(inout) :: str
integer :: cmdcode
cmdcode = INVALID_CMD
if ( (numargs > 1) .and. &
((str == '--new') .or. (str == '-n')) ) then
cmdcode = NEWNOTE
end if
if ( (str == '--list') .or. (str == '-l') ) then
cmdcode = LISTNOTES
end if
if ( (numargs > 1) .and. &
((str == '--remove') .or. (str == '-r')) ) then
cmdcode = REMOVENOTE
end if
end function
!
! name: get_arg
! desc: Reads the n'th cmd-line argument from the environment and
! puts it into the "str" output argument.
! @param n: number of argument to read. Range 1..num of args.
! @param str: the corresponding argument is placed here.
!
subroutine get_arg(n, str)
integer, intent(in) :: n
character(len=:), allocatable, intent(out) :: str
integer :: arg_num
integer :: arg_len
arg_num = command_argument_count()
if ( (n <= arg_num) .and. (n > 0) ) then
call get_command_argument(number=n, length=arg_len)
allocate( character(len=arg_len) :: str )
call get_command_argument(number=n, value=str)
end if
end subroutine
!
! name: dealloc_arg
! desc: Helper subroutine for deallocating a character string.
! @param str: character string to de-allocate.
!
subroutine dealloc_arg(str)
character(len=:), allocatable, intent(inout) :: str
if (allocated(str)) then
deallocate(str)
end if
end subroutine
!
! name: usage
! desc: Helper subroutine for displaying a brief help message.
! @param str: optional text message to show to the user.
!
subroutine usage(str)
character(len=*), intent(in), optional :: str
if ( present(str) ) then
print '(2x,a)', str
end if
print *, 'Usage:'
print *, ' fnote --new "my note": create a new note'
print *, ' fnote --list: list all notes'
print *, ' fnote --remove <id>: remove a note'
end subroutine
end program main
|
# Copyright (c) 2017, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
from ...models.tree_ensemble import (
TreeEnsembleRegressor as _TreeEnsembleRegressor,
TreeEnsembleClassifier,
)
from ..._deps import _HAS_XGBOOST
import numpy as _np
from six import string_types as _string_types
if _HAS_XGBOOST:
import xgboost as _xgboost
def recurse_json(
mlkit_tree,
xgb_tree_json,
tree_id,
node_id,
feature_map,
force_32bit_float,
mode="regressor",
tree_index=0,
n_classes=2,
):
"""Traverse through the tree and append to the tree spec.
"""
relative_hit_rate = None
try:
relative_hit_rate = xgb_tree_json["cover"]
except KeyError:
pass
# Fill node attributes
if "leaf" not in xgb_tree_json:
branch_mode = "BranchOnValueLessThan"
split_name = xgb_tree_json["split"]
feature_index = split_name if not feature_map else feature_map[split_name]
# xgboost internally uses float32, but the parsing from json pulls it out
# as a 64bit double. To trigger the internal float32 detection in the
# tree ensemble compiler, we need to explicitly cast it to a float 32
# value, then back to the 64 bit float that protobuf expects. This is
# controlled with the force_32bit_float flag.
feature_value = xgb_tree_json["split_condition"]
if force_32bit_float:
feature_value = float(_np.float32(feature_value))
true_child_id = xgb_tree_json["yes"]
false_child_id = xgb_tree_json["no"]
# Get the missing value behavior correct
missing_value_tracks_true_child = False
try:
if xgb_tree_json["missing"] == true_child_id:
missing_value_tracks_true_child = True
except KeyError:
pass
mlkit_tree.add_branch_node(
tree_id,
node_id,
feature_index,
feature_value,
branch_mode,
true_child_id,
false_child_id,
relative_hit_rate=relative_hit_rate,
missing_value_tracks_true_child=missing_value_tracks_true_child,
)
else:
value = xgb_tree_json["leaf"]
if force_32bit_float:
value = float(_np.float32(value))
if mode == "classifier" and n_classes > 2:
value = {tree_index: value}
mlkit_tree.add_leaf_node(
tree_id, node_id, value, relative_hit_rate=relative_hit_rate
)
# Now recurse
if "children" in xgb_tree_json:
for child in xgb_tree_json["children"]:
recurse_json(
mlkit_tree,
child,
tree_id,
child["nodeid"],
feature_map,
force_32bit_float,
mode=mode,
tree_index=tree_index,
n_classes=n_classes,
)
def convert_tree_ensemble(
model,
feature_names,
target,
force_32bit_float,
mode="regressor",
class_labels=None,
n_classes=None,
):
"""Convert a generic tree model to the protobuf spec.
This currently supports:
* Decision tree regression
Parameters
----------
model: str | Booster
Path on disk where the XGboost JSON representation of the model is or
a handle to the XGboost model.
feature_names : list of strings or None
Names of each of the features. When set to None, the feature names are
extracted from the model.
target: str,
Name of the output column.
force_32bit_float: bool
If True, then the resulting CoreML model will use 32 bit floats internally.
mode: str in ['regressor', 'classifier']
Mode of the tree model.
class_labels: list[int] or None
List of classes. When set to None, the class labels are just the range from
0 to n_classes - 1.
n_classes: int or None
Number of classes in classification. When set to None, the number of
classes is expected from the model or class_labels should be provided.
Returns
-------
model_spec: An object of type Model_pb.
Protobuf representation of the model
"""
if not (_HAS_XGBOOST):
raise RuntimeError("xgboost not found. xgboost conversion API is disabled.")
accepted_modes = ["regressor", "classifier"]
if mode not in accepted_modes:
raise ValueError("mode should be in %s" % accepted_modes)
import json
import os
feature_map = None
if isinstance(
model, (_xgboost.core.Booster, _xgboost.XGBRegressor, _xgboost.XGBClassifier)
):
# Testing a few corner cases that we don't support
if isinstance(model, _xgboost.XGBRegressor):
if mode == "classifier":
raise ValueError("mode is classifier but provided a regressor")
try:
objective = model.get_xgb_params()["objective"]
except:
objective = None
if objective in ["reg:gamma", "reg:tweedie"]:
raise ValueError(
"Regression objective '%s' not supported for export." % objective
)
if isinstance(model, _xgboost.XGBClassifier):
if mode == "regressor":
raise ValueError("mode is regressor but provided a classifier")
n_classes = model.n_classes_
if class_labels is not None:
if len(class_labels) != n_classes:
raise ValueError(
"Number of classes in model (%d) does not match "
"length of supplied class list (%d)."
% (n_classes, len(class_labels))
)
else:
class_labels = list(range(n_classes))
# Now use the booster API.
if isinstance(model, (_xgboost.XGBRegressor, _xgboost.XGBClassifier)):
# Name change in 0.7
if hasattr(model, "get_booster"):
model = model.get_booster()
else:
model = model.booster()
# Xgboost sometimes has feature names in there. Sometimes does not.
if (feature_names is None) and (model.feature_names is None):
raise ValueError(
"The XGBoost model does not have feature names. They must be provided in convert method."
)
feature_names = model.feature_names
if feature_names is None:
feature_names = model.feature_names
xgb_model_str = model.get_dump(with_stats=True, dump_format="json")
if model.feature_names:
feature_map = {f: i for i, f in enumerate(model.feature_names)}
# Path on the file system where the XGboost model exists.
elif isinstance(model, _string_types):
if not os.path.exists(model):
raise TypeError("Invalid path %s." % model)
with open(model) as f:
xgb_model_str = json.load(f)
if feature_names is None:
raise ValueError(
"feature names must be provided in convert method if the model is a path on file system."
)
else:
feature_map = {f: i for i, f in enumerate(feature_names)}
else:
raise TypeError("Unexpected type. Expecting XGBoost model.")
if mode == "classifier":
if n_classes is None and class_labels is None:
raise ValueError(
"You must provide class_labels or n_classes when not providing the XGBClassifier"
)
elif n_classes is None:
n_classes = len(class_labels)
elif class_labels is None:
class_labels = range(n_classes)
if n_classes == 2:
# if we have only 2 classes we only have one sequence of estimators
base_prediction = [0.0]
else:
base_prediction = [0.0 for c in range(n_classes)]
# target here is the equivalent of output_features in scikit learn
mlkit_tree = TreeEnsembleClassifier(feature_names, class_labels, target)
mlkit_tree.set_default_prediction_value(base_prediction)
if n_classes == 2:
mlkit_tree.set_post_evaluation_transform("Regression_Logistic")
else:
mlkit_tree.set_post_evaluation_transform("Classification_SoftMax")
else:
mlkit_tree = _TreeEnsembleRegressor(feature_names, target)
mlkit_tree.set_default_prediction_value(0.5)
for xgb_tree_id, xgb_tree_str in enumerate(xgb_model_str):
if mode == "classifier" and n_classes > 2:
tree_index = xgb_tree_id % n_classes
else:
tree_index = 0
try:
# this means that the xgb_tree_str is a json dump and needs to be loaded
xgb_tree_json = json.loads(xgb_tree_str)
except:
# this means that the xgb_tree_str is loaded from a path in file system already and does not need to be reloaded
xgb_tree_json = xgb_tree_str
recurse_json(
mlkit_tree,
xgb_tree_json,
xgb_tree_id,
node_id=0,
feature_map=feature_map,
force_32bit_float=force_32bit_float,
mode=mode,
tree_index=tree_index,
n_classes=n_classes,
)
return mlkit_tree.spec
|
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_theme(style="darkgrid")
class Plotter:
def __init__(self, plotting_params: dict):
self._plotting_params = plotting_params
if self._plotting_params["type"] == "lineplot":
self._lineplot()
def _lineplot(self):
plt.figure(1)
for data,lab in zip(self._plotting_params["y_data"],self._plotting_params["y_data_labels"]):
plt.plot(
self._plotting_params["x_data"],
data,
label=lab,
)
plt.xlabel(self._plotting_params["xlabel"], fontsize=16)
plt.ylabel(self._plotting_params["ylabel"], fontsize=16)
plt.xticks(fontsize=16)
plt.yticks(fontsize=16)
plt.xlim(self._plotting_params["x_data"][0], self._plotting_params["x_data"][-1])
plt.legend()
plt.show()
|
[STATEMENT]
lemma [simp]: "x \<sqinter> y \<le> z \<squnion> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. x \<sqinter> y \<le> z \<squnion> x
[PROOF STEP]
by (rule_tac y = x in order_trans, simp_all)
|
!---------------------------------------------------------------------!
! OWNER: Ithaca Combustion Enterprise, LLC !
! COPYRIGHT: © 2012, Ithaca Combustion Enterprise, LLC !
! LICENSE: BSD 3-Clause License (The complete text of the license can !
! be found in the `LICENSE-ICE.txt' file included in the ISAT-CK7 !
! source directory.) !
!---------------------------------------------------------------------!
subroutine ellu_rad_upper( n, g, r )
! Determine the radius r of the ball covering the ellipsoid E given
! by { x | norm(G^T * x) <=1 ), where G is an n x n lower triangular
! matrix. The array g contains the matrix G (unpacked).
! S.B. Pope 6/12/04
implicit none
integer, parameter :: k_dp = kind(1.d0)
integer, intent(in) :: n
real(k_dp), intent(in) :: g(n,n)
real(k_dp), intent(out) :: r
integer :: itmax = 100 ! max. iterations in dgqt
real(k_dp) :: atol = 1.d-4, rtol = 1.d-4 ! tolerances for dgqt
integer :: info
real(k_dp) :: gi(n,n), alpha, delta, par, f
real(k_dp) :: a(n,n), b(n), x(n), z(n), wa1(n), wa2(n)
! Method: E = { y | y^T * y <= 1 } where y = G^T * x.
! Now x^T * x = y^T * G^{-1} * G^{-T} * y.
! Thus, with f(y) = -2 * y^T * G^{-1} * G^{-T} * y,
! r = sqrt(-f(y_m) ), where y_m is the minimizer of f, subject to |y|<=1.
gi = g
call dtrtri( 'L', 'N', n, gi, n, info ) ! gi = G^{-1}
if( info /= 0 ) then
write(0,*)'ellu_rad_upper: dtrtri failed, info = ', info
stop
endif
a = gi
! B = alpha * B * op(A) = -2 * G^{-1} * G^{-T}
alpha = -2.d0
call dtrmm ( 'R', 'L', 'T', 'N', n, n, alpha, gi, n, a, n )
delta = 1.d0
par = 0.d0
b = 0.d0
! minimize f(y) = (1/2) * y^T * A * y + b^T * y, subject to |y|<= delta
! = -2 * y^T * G^{-1} * G^{-T} * y
call dgqt(n,a,n,b,delta,rtol,atol,itmax,par,f,x,info,z,wa1,wa2)
if( info >= 3 ) then
write(0,*)'ellu_rad_upper: dgqt incomplete convergence, info = ', info
endif
if( f > 0.d0 ) then
write(0,*)'ellu_rad_upper: f positive, f = ', f
stop
endif
r = sqrt( -f )
return
end subroutine ellu_rad_upper
|
[STATEMENT]
lemma llist_all2_llengthD:
"llist_all2 P xs ys \<Longrightarrow> llength xs = llength ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. llist_all2 P xs ys \<Longrightarrow> llength xs = llength ys
[PROOF STEP]
by(simp add: llist_all2_conv_lzip)
|
State Before: R : Type u
inst✝ : CommSemiring R
x y z : R
h : IsCoprime x (y + x * z)
⊢ IsCoprime x y State After: R : Type u
inst✝ : CommSemiring R
x y z : R
h : IsCoprime (y + x * z) x
⊢ IsCoprime y x Tactic: rw [isCoprime_comm] at h⊢ State Before: R : Type u
inst✝ : CommSemiring R
x y z : R
h : IsCoprime (y + x * z) x
⊢ IsCoprime y x State After: no goals Tactic: exact h.of_add_mul_left_left
|
/*
Copyright [2021] [IBM Corporation]
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.
*/
#ifndef _MCAS_COMMON_BYTE_
#define _MCAS_COMMON_BYTE_
#include <cstddef>
#include <gsl/gsl_byte>
#ifndef MCAS_BYTE_USES_STD
/* For compilation with C++14 use gsl::byte, not C++17 std::byte */
#define MCAS_BYTE_USES_STD 0
#endif
namespace common
{
#if MCAS_BYTE_USES_STD
using byte = std::byte;
#else
using byte = gsl::byte; /* can be std::byte in C++17 */
#endif
}
#endif
|
(* Title: HOL/Auth/n_g2kAbsAfter_lemma_inv__20_on_rules.thy
Author: Yongjian Li and Kaiqiang Duan, State Key Lab of Computer Science, Institute of Software, Chinese Academy of Sciences
Copyright 2016 State Key Lab of Computer Science, Institute of Software, Chinese Academy of Sciences
*)
header{*The n_g2kAbsAfter Protocol Case Study*}
theory n_g2kAbsAfter_lemma_inv__20_on_rules imports n_g2kAbsAfter_lemma_on_inv__20
begin
section{*All lemmas on causal relation between inv__20*}
lemma lemma_inv__20_on_rules:
assumes b1: "r \<in> rules N" and b2: "(f=inv__20 )"
shows "invHoldForRule s f r (invariants N)"
proof -
have c1: "(\<exists> d. d\<le>N\<and>r=n_n_Store_i1 d)\<or>
(\<exists> d. d\<le>N\<and>r=n_n_AStore_i1 d)\<or>
(r=n_n_SendReqS_j1 )\<or>
(r=n_n_SendReqEI_i1 )\<or>
(r=n_n_SendReqES_i1 )\<or>
(r=n_n_RecvReq_i1 )\<or>
(r=n_n_SendInvE_i1 )\<or>
(r=n_n_SendInvS_i1 )\<or>
(r=n_n_SendInvAck_i1 )\<or>
(r=n_n_RecvInvAck_i1 )\<or>
(r=n_n_SendGntS_i1 )\<or>
(r=n_n_SendGntE_i1 )\<or>
(r=n_n_RecvGntS_i1 )\<or>
(r=n_n_RecvGntE_i1 )\<or>
(r=n_n_ASendReqIS_j1 )\<or>
(r=n_n_ASendReqSE_j1 )\<or>
(r=n_n_ASendReqEI_i1 )\<or>
(r=n_n_ASendReqES_i1 )\<or>
(r=n_n_SendReqEE_i1 )\<or>
(r=n_n_ARecvReq_i1 )\<or>
(r=n_n_ASendInvE_i1 )\<or>
(r=n_n_ASendInvS_i1 )\<or>
(r=n_n_ASendInvAck_i1 )\<or>
(r=n_n_ARecvInvAck_i1 )\<or>
(r=n_n_ASendGntS_i1 )\<or>
(r=n_n_ASendGntE_i1 )\<or>
(r=n_n_ARecvGntS_i1 )\<or>
(r=n_n_ARecvGntE_i1 )"
apply (cut_tac b1, auto) done
moreover {
assume d1: "(\<exists> d. d\<le>N\<and>r=n_n_Store_i1 d)"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_Store_i1Vsinv__20) done
}
moreover {
assume d1: "(\<exists> d. d\<le>N\<and>r=n_n_AStore_i1 d)"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_AStore_i1Vsinv__20) done
}
moreover {
assume d1: "(r=n_n_SendReqS_j1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_SendReqS_j1Vsinv__20) done
}
moreover {
assume d1: "(r=n_n_SendReqEI_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_SendReqEI_i1Vsinv__20) done
}
moreover {
assume d1: "(r=n_n_SendReqES_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_SendReqES_i1Vsinv__20) done
}
moreover {
assume d1: "(r=n_n_RecvReq_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_RecvReq_i1Vsinv__20) done
}
moreover {
assume d1: "(r=n_n_SendInvE_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_SendInvE_i1Vsinv__20) done
}
moreover {
assume d1: "(r=n_n_SendInvS_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_SendInvS_i1Vsinv__20) done
}
moreover {
assume d1: "(r=n_n_SendInvAck_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_SendInvAck_i1Vsinv__20) done
}
moreover {
assume d1: "(r=n_n_RecvInvAck_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_RecvInvAck_i1Vsinv__20) done
}
moreover {
assume d1: "(r=n_n_SendGntS_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_SendGntS_i1Vsinv__20) done
}
moreover {
assume d1: "(r=n_n_SendGntE_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_SendGntE_i1Vsinv__20) done
}
moreover {
assume d1: "(r=n_n_RecvGntS_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_RecvGntS_i1Vsinv__20) done
}
moreover {
assume d1: "(r=n_n_RecvGntE_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_RecvGntE_i1Vsinv__20) done
}
moreover {
assume d1: "(r=n_n_ASendReqIS_j1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_ASendReqIS_j1Vsinv__20) done
}
moreover {
assume d1: "(r=n_n_ASendReqSE_j1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_ASendReqSE_j1Vsinv__20) done
}
moreover {
assume d1: "(r=n_n_ASendReqEI_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_ASendReqEI_i1Vsinv__20) done
}
moreover {
assume d1: "(r=n_n_ASendReqES_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_ASendReqES_i1Vsinv__20) done
}
moreover {
assume d1: "(r=n_n_SendReqEE_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_SendReqEE_i1Vsinv__20) done
}
moreover {
assume d1: "(r=n_n_ARecvReq_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_ARecvReq_i1Vsinv__20) done
}
moreover {
assume d1: "(r=n_n_ASendInvE_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_ASendInvE_i1Vsinv__20) done
}
moreover {
assume d1: "(r=n_n_ASendInvS_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_ASendInvS_i1Vsinv__20) done
}
moreover {
assume d1: "(r=n_n_ASendInvAck_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_ASendInvAck_i1Vsinv__20) done
}
moreover {
assume d1: "(r=n_n_ARecvInvAck_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_ARecvInvAck_i1Vsinv__20) done
}
moreover {
assume d1: "(r=n_n_ASendGntS_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_ASendGntS_i1Vsinv__20) done
}
moreover {
assume d1: "(r=n_n_ASendGntE_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_ASendGntE_i1Vsinv__20) done
}
moreover {
assume d1: "(r=n_n_ARecvGntS_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_ARecvGntS_i1Vsinv__20) done
}
moreover {
assume d1: "(r=n_n_ARecvGntE_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_ARecvGntE_i1Vsinv__20) done
}
ultimately show "invHoldForRule s f r (invariants N)"
by satx
qed
end
|
#ifdef ENABLE_HOLO_DSCP2
#include "HoloRenderDSCP2.hpp"
#include "../holoutils/HoloUtils.hpp"
#include <boost/filesystem.hpp>
#include <future>
#if defined(__linux) || defined(__unix) || defined(__posix)
#include <X11/Xlib.h>
#endif
using namespace holo;
using namespace holo::render;
HoloRenderDSCP2::HoloRenderDSCP2(int headNumber, std::string displayEnv) : IHoloRender(),
displayEnv_(displayEnv),
haveNewCloud_(false),
textureID_(0),
headNum_(headNumber),
masterHologramGain_(HOLO_RENDER_DSCP2_MASTER_HOLOGRAM_GAIN),
viewEnableBitmask_(HOLO_RENDER_DSCP2_VIEW_ENABLE_BITMASK),
zeroDepth_(HOLO_RENDER_DSCP2_ZERO_DEPTH),
zeroModulation_(HOLO_RENDER_DSCP2_ZERO_MODULATION),
fakeZ_(HOLO_RENDER_DSCP2_FAKE_Z),
fakeModulation_(HOLO_RENDER_DSCP2_FAKE_MODULATION),
hologramOutputDebugSwitch_(0),
enableDrawDepth_(0), rotateCounter_(0),
frameNumber_(0), currentTime_(0), timeBase_(0),
displayModeWidth_(HOLO_RENDER_DSCP2_DISPLAY_MODE_WIDTH),
displayModeHeight_(HOLO_RENDER_DSCP2_DISPLAY_MODE_HEIGHT),
hologramPlaneWidthMM_(HOLO_RENDER_DSCP2_VIEW_RENDER_HOLOGRAM_PLANE_WIDTH_MM),
hologramPlaneHeightMM_(HOLO_RENDER_DSCP2_VIEW_RENDER_HOLOGRAM_PLANE_HEIGHT_MM),
nearPlane_(HOLO_RENDER_DSCP2_PLANE_NEAR),
farPlane_(HOLO_RENDER_DSCP2_PLANE_FAR),
numX_(HOLO_RENDER_DSCP2_VIEW_RENDER_RES_HORIZ),
numY_(HOLO_RENDER_DSCP2_VIEW_RENDER_RES_VERT),
tileX_(HOLO_RENDER_DSCP2_VIEW_RENDER_TILE_X),
tileY_(HOLO_RENDER_DSCP2_VIEW_RENDER_TILE_Y),
numViewsPerPixel_(HOLO_RENDER_DSCP2_VIEW_RENDER_NUM_VIEWS_PER_PIXEL),
mag_(HOLO_RENDER_DSCP2_VIEW_RENDER_MAG),
fieldOfView_(HOLO_RENDER_DSCP2_VIEW_RENDER_FOV),
lightLocationX_(HOLO_RENDER_DSCP2_LIGHT_LOCATION_X),
lightLocationY_(HOLO_RENDER_DSCP2_LIGHT_LOCATION_Y),
lightLocationZ_(HOLO_RENDER_DSCP2_LIGHT_LOCATION_Z),
translateX_(0.0f),
translateY_(0.0f),
translateZ_(0.0f),
rot_(0.0f),
rotX_(0.0f),
parallaxViewVertexProgramName_(HOLO_RENDER_DSCP2_CG_PARALLAX_VIEW_VERTEX_PROGRAM_NAME),
parallaxViewVertexProgramFileName_(HOLO_RENDER_DSCP2_CG_PARALLAX_VIEW_VERTEX_PROGRAM_FILENAME),
parallaxViewFragmentProgramName_(HOLO_RENDER_DSCP2_CG_PARALLAX_VIEW_FRAGMENT_PROGRAM_NAME),
parallaxViewFragmentProgramFileName_(HOLO_RENDER_DSCP2_CG_PARALLAX_VIEW_FRAGMENT_PROGRAM_FILENAME),
fringePatternVertexProgramName_(HOLO_RENDER_DSCP2_CG_FRINGE_PATTERN_VERTEX_PROGRAM_NAME),
fringePatternVertexProgramFileName_(HOLO_RENDER_DSCP2_CG_FRINGE_PATTERN_VERTEX_PROGRAM_FILENAME),
fringePatternFragmentProgramName_(HOLO_RENDER_DSCP2_CG_FRINGE_PATTERN_FRAGMENT_PROGRAM_NAME),
fringePatternFragmentProgramFileName_(HOLO_RENDER_DSCP2_CG_FRINGE_PATTERN_FRAGMENT_PROGRAM_FILENAME),
cgContext_(nullptr),
parallaxViewCgVertexProgram_(nullptr),
parallaxViewCgFragmentProgram_(nullptr),
parallaxViewCgVertexProfile_(CG_PROFILE_UNKNOWN),
parallaxViewCgFragmentProfile_(CG_PROFILE_UNKNOWN),
fringePatternCgVertexProfile_(CG_PROFILE_UNKNOWN),
fringePatternCgFragmentProfile_(CG_PROFILE_UNKNOWN),
localFramebufferStore_(nullptr),
firstInit_(true),
isInit_(false),
parallaxViewVertexArgs_(),
parallaxViewFragmentArgs_(),
fringeFragmentArgs_()
{
gCurrentDSCP2Instance = this;
logger_ = log4cxx::Logger::getLogger("edu.mit.media.obmg.holosuite.render.dscp2");
LOG4CXX_DEBUG(logger_, "Instantiating HoloRenderDSCP2 object with default values...");
viewTexWidth_ = numX_ * tileX_;
viewTexHeight_ = numY_ * tileY_ * 2; //tiley views of numy pixels, X 2 (depth, luminance) was 256;
numViews_ = tileX_ * tileY_ * numViewsPerPixel_;
lightAmbient_[0] = 0.5f;
lightAmbient_[1] = 0.5f;
lightAmbient_[2] = 0.5f;
lightAmbient_[3] = 1.0f;
lightDiffuse_[0] = 1.0f;
lightDiffuse_[1] = 1.0f;
lightDiffuse_[2] = 1.0f;
lightDiffuse_[3] = 1.0f;
// set light position
lightPosition_[0] = 0.0f;
lightPosition_[1] = 0.0f;
lightPosition_[2] = -2.0f;
lightPosition_[3] = 1.0f;
// set light color to white { 0.95f, 0.95f, 0.95f }
lightColor_[0] = 0.95f;
lightColor_[1] = 0.95f;
lightColor_[2] = 0.95f;
// set to dim color { 0.1f, 0.1f, 0.1f }
globalAmbient_[0] = 0.1f;
globalAmbient_[1] = 0.1f;
globalAmbient_[2] = 0.1f;
memset(projectionMatrix1_, 0, sizeof(GLfloat)* 16);
memset(projectionMatrix2_, 0, sizeof(GLfloat)* 16);
localFramebufferStore_ = new GLubyte[viewTexWidth_ * viewTexHeight_ * 4];
LOG4CXX_INFO(logger_, "Window environment display mode resolution: " << displayModeWidth_ << "x" << displayModeHeight_);
LOG4CXX_DEBUG(logger_, "Done instantiating HoloRenderDSCP2 object");
}
HoloRenderDSCP2::HoloRenderDSCP2() : HoloRenderDSCP2(0, "")
{
}
HoloRenderDSCP2::~HoloRenderDSCP2()
{
LOG4CXX_DEBUG(logger_, "Destroying HoloRenderDSCP2 object...");
if (localFramebufferStore_)
{
delete[] localFramebufferStore_;
localFramebufferStore_ = nullptr;
}
LOG4CXX_DEBUG(logger_, "Done destroying HoloRenderDSCP2 object");
}
bool HoloRenderDSCP2::init(bool enableMirrorVisualFeedback)
{
LOG4CXX_INFO(logger_, "Initializing DSCP2 render algorithm...");
// Get the screen resolution from the desktop (Windows or X11)
#ifdef WIN32
RECT desktop;
// Get a handle to the desktop window
const HWND hDesktop = GetDesktopWindow();
// Get the size of screen to the variable desktop
GetWindowRect(hDesktop, &desktop);
// The top left corner will have coordinates (0,0)
// and the bottom right corner will have coordinates
// (horizontal, vertical)
displayModeWidth_ = desktop.right;
displayModeHeight_ = desktop.bottom;
#elif defined(__linux) || defined(__unix) || defined(__posix)
Display *displayName;
int depth, screen, connection;
const char * displayHeadVar;
if (!displayEnv_.empty())
displayEnv_ = std::string(getenv("DISPLAY"));
displayHeadVar = displayEnv_.c_str();
if(displayHeadVar == nullptr)
{
LOG4CXX_ERROR(logger_, "DISPLAY envirnoment variable not set. Please set which head to run DSCP2 algorithm on by typing something like DISPLAY=:0.0");
}
LOG4CXX_INFO(logger_, "Running DSCP2 OpenGL window on X display " << displayHeadVar);
/*Opening display and setting defaults*/
displayName = XOpenDisplay(displayHeadVar);
screen = DefaultScreen(displayName);
displayModeWidth_ = DisplayWidth(displayName, screen);
displayModeHeight_ = DisplayHeight(displayName, screen);
#endif
cloud_ = HoloCloudPtr(new HoloCloud);
glutInitThread_ = std::thread(&HoloRenderDSCP2::glutInitLoop, this);
std::unique_lock<std::mutex> lg(hasInitMutex_);
hasInitCV_.wait(lg);
return isInit_;
}
void HoloRenderDSCP2::glutInitLoop()
{
GLenum glError = GL_NO_ERROR;
CGerror cgError = CG_NO_ERROR;
#ifdef WIN32
//char fakeParam[] = "dscp2";
const char *fakeargv[] = { "holosuite", NULL };
int fakeargc = 1;
#elif defined(__linux) || defined(__unix) || defined(__posix)
char displayEnvArg[1024];
strncpy(displayEnvArg, displayEnv_.c_str(), displayEnv_.length());
const char *fakeargv[] = { "holosuite", "-display", displayEnvArg, NULL };
int fakeargc = 3;
#endif
//glCheckErrors();
// Initialize GLUT window and callbacks
glutInit(&fakeargc, const_cast<char**>(fakeargv));
glutInitWindowSize(displayModeWidth_, displayModeHeight_);
glutInitDisplayMode(GLUT_RGBA | GLUT_ALPHA | GLUT_DOUBLE | GLUT_DEPTH);
std::stringstream ss;
ss << HOLO_RENDER_DSCP2_WINDOW_NAME << ":" << headNum_;
glutCreateWindow(ss.str().c_str());
glCheckErrors();
glutDisplayFunc(this->glutDisplay);
glutKeyboardFunc(this->glutKeyboard);
glutIdleFunc(this->glutIdle);
atexit(this->glutCleanup);
// GLUT settings
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background
glShadeModel(GL_SMOOTH); // Enable Smooth Shading
glLightfv(GL_LIGHT0, GL_AMBIENT, lightAmbient_); // Setup The Ambient Light
glLightfv(GL_LIGHT0, GL_DIFFUSE, lightDiffuse_); // Setup The Diffuse Light
glLightfv(GL_LIGHT0, GL_POSITION, lightPosition_); // Position The Light
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST); // Enables Depth Testing
glEnable(GL_COLOR_MATERIAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
//glClearColor(0, 0, 0, 0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0f, static_cast<float>(displayModeWidth_) / static_cast<float>(displayModeHeight_), 0.01f, 3.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0, 0, 0, 0, 0, 1, 0, 1, 1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glDisable(GL_LIGHTING);
// Creates a texture ID for our parallax view generation
glGenTextures(1, &textureID_);
// Set up view texture (holds all view images. TODO: convert to 2 3d textures
glBindTexture(GL_TEXTURE_2D, textureID_);
// Set texture parameters
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
// Specify a 2-dimensional texture image and uploads it to video memory, make it ready to use in shaders
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, viewTexWidth_, viewTexHeight_, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glDisable(GL_TEXTURE_2D);
//double q = tan(0.1);
//holo::utils::BuildShearOrthographicMatrix2(-0.75f * mag_, -0.75f * mag_, -0.375f * mag_, 0.375f * mag_, 0.450f * mag_, 0.750f * mag_, q / mag_, projectionMatrix1_);
// CG program intialization
cgGLSetDebugMode(CG_FALSE);
cgContext_ = cgCreateContext();
checkForCgError("Creating normal map lighting context...");
// Panoramagram generation vertex program
parallaxViewCgVertexProfile_ = cgGLGetLatestProfile(CG_GL_VERTEX);
cgGLSetOptimalOptions(parallaxViewCgVertexProfile_);
checkForCgError("Selecting vertex profile...");
parallaxViewCgVertexProgram_ = cgCreateProgramFromFile(cgContext_, CG_SOURCE, parallaxViewVertexProgramFileName_, parallaxViewCgVertexProfile_, parallaxViewVertexProgramName_, NULL);
checkForCgError("Creating vertex program from file");
cgGLLoadProgram(parallaxViewCgVertexProgram_);
checkForCgError("Loading vertex program");
LOG4CXX_INFO(logger_, "Loaded panoramagram vertex program file: " << parallaxViewVertexProgramFileName_);
parallaxViewVertexArgs_.modelViewProj = cgGetNamedParameter(parallaxViewCgVertexProgram_, "modelViewProj");
checkForCgError("could not get modelViewProj vertex parameter ln 1707");
//cgVertexParamTextureMatrix_ = cgGetNamedParameter(parallaxViewCgVertexProgram_, "textureMatrix");
//checkForCgError("could not get textureMatrix vertex parameter ln 1707");
//cgVertexParamDepthMatrix_ = cgGetNamedParameter(parallaxViewCgVertexProgram_, "depthMatrix");
//checkForCgError("could not get depthMatrix vertex parameter ln 1707");
//cgVertexParamDrawdepth_ = cgGetNamedParameter(parallaxViewCgVertexProgram_, "drawDepth");
//checkForCgError("could not get drawDepth vertex parameter ln 1707");
// Panoramagram generation fragment program
parallaxViewCgFragmentProfile_ = cgGLGetLatestProfile(CG_GL_FRAGMENT);
cgGLSetOptimalOptions(parallaxViewCgFragmentProfile_);
checkForCgError("Selecting fragment profile...");
parallaxViewCgFragmentProgram_ = cgCreateProgramFromFile(cgContext_, CG_SOURCE, parallaxViewFragmentProgramFileName_, parallaxViewCgFragmentProfile_, parallaxViewFragmentProgramName_, NULL);
checkForCgError("Creating fragment program");
cgGLLoadProgram(parallaxViewCgFragmentProgram_);
checkForCgError("loading fragment program");
LOG4CXX_INFO(logger_, "Loaded panoramagram fragment program file: " << parallaxViewFragmentProgramFileName_);
parallaxViewFragmentArgs_.globalAmbient = cgGetNamedParameter(parallaxViewCgFragmentProgram_, "globalAmbient");
parallaxViewFragmentArgs_.lightColor = cgGetNamedParameter(parallaxViewCgFragmentProgram_, "lightColor");
parallaxViewFragmentArgs_.lightPosition = cgGetNamedParameter(parallaxViewCgFragmentProgram_, "lightPosition");
parallaxViewFragmentArgs_.eyePosition = cgGetNamedParameter(parallaxViewCgFragmentProgram_, "eyePosition");
parallaxViewFragmentArgs_.ke = cgGetNamedParameter(parallaxViewCgFragmentProgram_, "Ke");
parallaxViewFragmentArgs_.ka = cgGetNamedParameter(parallaxViewCgFragmentProgram_, "Ka");
parallaxViewFragmentArgs_.kd = cgGetNamedParameter(parallaxViewCgFragmentProgram_, "Kd");
parallaxViewFragmentArgs_.ks = cgGetNamedParameter(parallaxViewCgFragmentProgram_, "Ks");
parallaxViewFragmentArgs_.shininess = cgGetNamedParameter(parallaxViewCgFragmentProgram_, "shininess");
parallaxViewFragmentArgs_.drawDepth = cgGetNamedParameter(parallaxViewCgFragmentProgram_, "drawdepth");
parallaxViewFragmentArgs_.headNum = cgGetNamedParameter(parallaxViewCgFragmentProgram_, "headnum");
parallaxViewFragmentArgs_.decal = cgGetNamedParameter(parallaxViewCgFragmentProgram_, "decal");
checkForCgError("Getting fragment program decal parameter");
cgGLSetTextureParameter(parallaxViewFragmentArgs_.decal, textureID_);
checkForCgError("Setting decal texture");
// Set light source color parameters once.
cgSetParameter3fv(parallaxViewFragmentArgs_.globalAmbient, globalAmbient_);
checkForCgError("Setting fragment global ambient lighting");
cgSetParameter3fv(parallaxViewFragmentArgs_.lightColor, lightColor_);
checkForCgError("Setting fragment program light color");
// Set up head number for rendering/loading with skipped lines
cgSetParameter1i(parallaxViewFragmentArgs_.headNum, headNum_);
checkForCgError("Setting head number parameter");
boost::filesystem::path workingDir(boost::filesystem::current_path());
LOG4CXX_INFO(logger_, "Accessing Cg files from working directory: " << workingDir.string());
// Fringe computation vertex program
fringePatternCgVertexProfile_ = cgGLGetLatestProfile(CG_GL_VERTEX);
cgGLSetOptimalOptions(fringePatternCgVertexProfile_);
checkForCgError("Selecting vertex profile");
fringePatternCgVertexProgram_ = cgCreateProgramFromFile(cgContext_, CG_SOURCE, fringePatternVertexProgramFileName_, fringePatternCgVertexProfile_, fringePatternVertexProgramName_, NULL);
checkForCgError2("Creating fringe vertex program from file");
cgGLLoadProgram(fringePatternCgVertexProgram_);
checkForCgError2("Loading vertex program");
LOG4CXX_INFO(logger_, "Loaded fringe computation vertex program file: " << fringePatternVertexProgramName_);
// Fringe computation fragment program
fringePatternCgFragmentProfile_ = cgGLGetLatestProfile(CG_GL_FRAGMENT);
cgGLSetOptimalOptions(fringePatternCgFragmentProfile_);
checkForCgError2("Selecting fragment profile");
fringePatternCgFragmentProgram_ = cgCreateProgramFromFile(cgContext_, CG_SOURCE, fringePatternFragmentProgramFileName_, fringePatternCgFragmentProfile_, fringePatternFragmentProgramName_, NULL);
checkForCgError2("creating fragment program from file");
cgGLLoadProgram(fringePatternCgFragmentProgram_);
checkForCgError2("loading fragment program");
LOG4CXX_INFO(logger_, "Loaded fringe computation fragment program file: " << fringePatternFragmentProgramFileName_);
fringeFragmentArgs_.hogelYes = cgGetNamedParameter(fringePatternCgFragmentProgram_, "hogelYes");
cgSetParameter1f(fringeFragmentArgs_.hogelYes, 0.0f);
fringeFragmentArgs_.hologramGain = cgGetNamedParameter(fringePatternCgFragmentProgram_, "hologramGain");
cgSetParameter1f(fringeFragmentArgs_.hologramGain, masterHologramGain_);
fringeFragmentArgs_.debugSwitch = cgGetNamedParameter(fringePatternCgFragmentProgram_, "hologramDebugSwitch");
cgSetParameter1f(fringeFragmentArgs_.debugSwitch, hologramOutputDebugSwitch_);
fringeFragmentArgs_.headNum = cgGetNamedParameter(fringePatternCgFragmentProgram_, "headnum");
cgSetParameter1f(fringeFragmentArgs_.headNum, headNum_);
fringeFragmentArgs_.decal = cgGetNamedParameter(fringePatternCgFragmentProgram_, "decal0");
checkForCgError2("getting decal parameter");
cgGLSetTextureParameter(fringeFragmentArgs_.decal, textureID_);
checkForCgError2("setting decal 3D texture0");
glCheckErrors();
glutMainLoop();
}
void HoloRenderDSCP2::glCheckErrors()
{
GLenum error;
while ((error = glGetError()) != GL_NO_ERROR)
{
LOG4CXX_WARN(logger_, "OpenGL error: " << gluErrorString(error));
}
}
void HoloRenderDSCP2::idle()
{
// refresh point cloud data
if (haveNewCloud_.load())
glutPostRedisplay();
#ifdef TRACE_LOG_ENABLED
float fps;
if (rotateCounter_ == 1)
{
rot_ = rot_ - 5;
rot_ = fmod(rot_, 360);
}
//tz=tz-.5;
// glutPostRedisplay();
frameNumber_++;
currentTime_ = glutGet(GLUT_ELAPSED_TIME);
//printf("idle\n");
if (currentTime_ - timeBase_ > 1000)
{
const int len = 1024;
char msg[len];
// printf("here\n");
fps = frameNumber_ * 1000.0 / (currentTime_ - timeBase_);
timeBase_ = currentTime_;
frameNumber_ = 0;
//sprintf(msg, "Wafel %d fps: %f\n", headNumber_, fps);
//printf("%s", msg);
LOG4CXX_TRACE(logger_, "DSCP2 rendering on head " << headNum_ << " @ " << fps << " fps");
// fflush(stdout);
}
#endif
}
void HoloRenderDSCP2::keyboard(unsigned char c, int x, int y)
{
//printf("keyboard \n");
switch (c)
{
case 'z': //invert set of disabled views
viewEnableBitmask_ = ~viewEnableBitmask_;
break;
case 'Z': //enable all views
viewEnableBitmask_ = -1;
break;
case 'x': //cycle through debug modes in shader (output intermediate variables)
hologramOutputDebugSwitch_++;
hologramOutputDebugSwitch_ = hologramOutputDebugSwitch_ % HOLO_RENDER_DSCP2_NUM_DEBUG_SWITCHES;
cgSetParameter1f(fringeFragmentArgs_.debugSwitch, hologramOutputDebugSwitch_);
break;
case 'X':
hologramOutputDebugSwitch_--;
hologramOutputDebugSwitch_ = hologramOutputDebugSwitch_ % HOLO_RENDER_DSCP2_NUM_DEBUG_SWITCHES;
cgSetParameter1f(fringeFragmentArgs_.debugSwitch, hologramOutputDebugSwitch_);
break;
case 'j':
translateX_ = translateX_ + 0.01;
printf("tx %f \n", translateX_);
break;
case 'l':
translateX_ = translateX_ - 0.01;
printf("tx %f \n", translateX_);
break;
case 'i':
translateY_ = translateY_ - 0.01;
printf("ty %f \n", translateY_);
break;
case 'k':
translateY_ = translateY_ + 0.01;
printf("ty %f \n", translateY_);
break;
case 'w':
translateZ_ = translateZ_ - 0.01;
printf("%f \n", translateZ_ - 0.675);
break;
case 's':
translateZ_ = translateZ_ + 0.01;
printf("%f \n", translateZ_ - 0.675);
break;
case 'f':
//writeToFile2();
break;
case 'F':
//printf("writing view texture\n");
//writeViewsToFile();
break;
case 'e':
translateZ_ = translateZ_ - 0.01;
printf("%f \n", translateZ_ - 675);
break;
case 'd':
translateZ_ = translateZ_ + 0.01;
printf("%f \n", translateZ_ - 675);
break;
case 'c':
translateZ_ = 0;
printf("%f \n", translateZ_ - 675);
break;
case 'r':
rot_ = rot_ - 5;
rotateCounter_ = (rotateCounter_ * -1) + 1;
printf("rotate %i \n", rotateCounter_);
break;
case ' ':
//makeViewtexFromFile();
break;
case ']':
lightLocationZ_ = lightLocationZ_ - 1.0f;
printf("%f \n", lightLocationZ_);
break;
case '[':
lightLocationZ_ = lightLocationZ_ + 1.0f;
printf("%f \n", lightLocationZ_);
break;
case '=':
lightLocationY_ = lightLocationY_ - 1.0f;
printf("%f \n", lightLocationY_);
break;
case '-':
lightLocationY_ = lightLocationY_ + 1.0f;
printf("%f \n", lightLocationY_);
break;
case ';':
lightLocationX_ = lightLocationX_ - 1.0f;
printf("%f \n", lightLocationX_);
break;
case '/':
lightLocationX_ = lightLocationX_ + 1.0f;
printf("%f \n", lightLocationX_);
break;
case '1':
glEnable(GL_LIGHTING);
//cgSetParameter1f(myCgFragmentParam_hogelYes, 0.);
//cgUpdateProgramParameters(myCgFragmentProgram2);
//printf("Wafel");
break;
case '2':
glDisable(GL_LIGHTING);
//cgSetParameter1f(myCgFragmentParam_hogelYes, 1.);
//cgUpdateProgramParameters(myCgFragmentProgram2);
//printf("Hogel");
break;
case 27: /* Esc key */
/* Demonstrate proper deallocation of Cg runtime data structures.
Not strictly necessary if we are simply going to exit. */
cgDestroyProgram(parallaxViewCgVertexProgram_);
cgDestroyContext(cgContext_);
// ShutDown();
exit(0);
break;
}
int mods = glutGetModifiers();
if (mods != 0)
{
if (c >= '0' && c <= '9') viewEnableBitmask_ ^= 1 << (c - '0' + 10); //toggle view enable bit for numbered view 10-19 (only 16 views used)
}
else {
if (c >= '0' && c <= '9') viewEnableBitmask_ ^= 1 << (c - '0'); //toggle view enable bit for numbered view 0-9
}
glutPostRedisplay();
}
void HoloRenderDSCP2::display()
{
if (firstInit_)
{
//cv::namedWindow("TextureView", CV_WINDOW_FREERATIO);
firstInit_ = false;
isInit_ = true;
hasInitCV_.notify_all();
}
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
#if 1
/* World-space positions for light and eye. */
float eyePosition[4] = { 0, 0, 0, 1 };
const float lightPosition[4] = { .010f * mag_ + lightLocationX_, .020f * mag_ + lightLocationY_, -0.605f * mag_ + lightLocationZ_, 1.0f };
float xpos, h, v, rgba, scale;
int i, j;
float translateMatrix[16], rotateMatrix[16], rotateMatrix1[16],
translateNegMatrix[16], rotateTransposeMatrix[16],
rotateTransposeMatrix1[16], scaleMatrix[16], scaleNegMatrix[16],
modelMatrix_sphere[16], invModelMatrix_sphere[16],
modelMatrix_cone[16], invModelMatrix_cone[16],
objSpaceLightPosition_sphere[16], objSpaceLightPosition_cone[16],
objSpaceEyePosition_sphere[16];
glPushAttrib(GL_VIEWPORT_BIT | GL_COLOR_BUFFER_BIT);
glEnable(GL_TEXTURE_2D);
//glBindTexture(GL_TEXTURE_2D, textureIDs_[headNum]);
cgGLBindProgram(parallaxViewCgVertexProgram_);
checkForCgError("Binding vertex lighting program");
cgGLEnableProfile(parallaxViewCgVertexProfile_);
checkForCgError("Enabling vertex profile lighting");
cgGLBindProgram(parallaxViewCgFragmentProgram_);
checkForCgError("Binding fragment program lighting");
cgGLEnableProfile(parallaxViewCgFragmentProfile_);
checkForCgError("enabling fragment profile lighting");
/*for sphere find model and invModelMatrix */
//TODO: recompute these only on change:
holo::utils::MakeRotateMatrix(rot_, 0, 1, 0, rotateMatrix);
holo::utils::MakeRotateMatrix(-rot_, 0, 1, 0, rotateTransposeMatrix);
holo::utils::MakeRotateMatrix(180 + rotX_, 1, 0, 0, rotateMatrix1);
holo::utils::MakeRotateMatrix(-180 - rotX_, 1, 0, 0, rotateTransposeMatrix1);
holo::utils::MultMatrix(rotateMatrix, rotateMatrix1, rotateMatrix);
holo::utils::MultMatrix(rotateTransposeMatrix, rotateTransposeMatrix1, rotateTransposeMatrix);
//z is -600 + tz (z shift tz is centered halfway between near & far planes)
holo::utils::MakeTranslateMatrix(translateX_, translateY_, -(farPlane_ + nearPlane_) * 0.5 * mag_ + translateZ_ * mag_, translateMatrix);
holo::utils::MakeTranslateMatrix(-translateX_, -translateY_, (farPlane_ + nearPlane_) * 0.5 * mag_ - translateZ_ * mag_, translateNegMatrix);
scale = 2;
holo::utils::MakeScaleMatrix(scale, scale, scale, scaleMatrix);
holo::utils::MakeScaleMatrix(1 / scale, 1 / scale, 1 / scale, scaleNegMatrix);
holo::utils::MultMatrix(modelMatrix_sphere, translateMatrix, rotateMatrix);
holo::utils::MultMatrix(invModelMatrix_sphere, rotateTransposeMatrix, translateNegMatrix);
holo::utils::MultMatrix(modelMatrix_sphere, modelMatrix_sphere, scaleMatrix);
holo::utils::MultMatrix(invModelMatrix_sphere, scaleNegMatrix, invModelMatrix_sphere);
/* Transform world-space eye and light positions to sphere's object-space. */
holo::utils::Transform(objSpaceLightPosition_sphere, invModelMatrix_sphere, lightPosition);
holo::utils::Transform(objSpaceEyePosition_sphere, invModelMatrix_sphere, eyePosition);
// glEnable(GL_CULL_FACE);
i = 0;
j = 0;
xpos = 0;
h = 0;
v = 0;
//glClearColor(0.5,0.5,0.5,0.5);//JB Hack: clear view buffer to gray for debugging
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
std::unique_lock<std::mutex> cloudLock(cloudMutex_);
for (i = 0; i < numViews_; i++)
{
if ((viewEnableBitmask_ & (1 << i)) == 0)
{
continue;
}
glClear(GL_DEPTH_BUFFER_BIT);
rgba = ((i / 4.0f) - int(i / 4.0f)) * 4.0f;
h = int(i / (tileY_ * 4)) * numX_;
v = (int(i / 4.0f) / ((float)tileY_) - int(int(i / 4.0f)
/ ((float)tileY_))) * numY_ * tileY_;
glColorMask((rgba == 0), (rgba == 1), (rgba == 2), (rgba == 3));
double q = tan((i - numViews_ / 2.0f) / numViews_ * fieldOfView_ / mag_ * M_PI/180.0f); //angle +/-fov/2
//hologram is 150 mm wide, 75 mm high
holo::utils::BuildShearOrthographicMatrix2(
-hologramPlaneWidthMM_ / 2.0f,
hologramPlaneWidthMM_ / 2.0f,
-hologramPlaneHeightMM_ / 2.0f,
hologramPlaneHeightMM_ / 2.0f,
nearPlane_ * mag_,
farPlane_* mag_,
q,
projectionMatrix1_);
glViewport(h, v, numX_, numY_);
enableDrawDepth_ = 0;
drawScene(eyePosition, modelMatrix_sphere, invModelMatrix_sphere,
objSpaceLightPosition_sphere, modelMatrix_cone,
invModelMatrix_cone, objSpaceLightPosition_cone, h, v,
enableDrawDepth_, 0, i);
//glViewport(h,v+120*tiley+16,160,120); //1024-6*160=64, (512-120*2*2)/2=16
glViewport(h, v + numY_ * tileY_, numX_, numY_); //setup viewport for depthbuffer render
enableDrawDepth_ = 1;
drawScene(eyePosition, modelMatrix_sphere, invModelMatrix_sphere,
objSpaceLightPosition_sphere, modelMatrix_cone,
invModelMatrix_cone, objSpaceLightPosition_cone, h, v,
enableDrawDepth_, 0, i);
//auto localFrameImg = cv::Mat(numY_, numX_, CV_8UC1);
//glReadPixels(0, 0, numX_, numY_, GL_RED, GL_UNSIGNED_BYTE, localFrameImg.data);
//cv::imshow("TextureView", localFrameImg);
//std::stringstream ss;
//ss << "c:\\temp\\img" << i << ".png";
//cv::imwrite(ss.str(), localFrameImg);
}
haveNewCloud_.store(false);
cloudLock.unlock();
cgGLDisableProfile(parallaxViewCgVertexProfile_);
//checkForCgError("disabling vertex profile");
cgGLDisableProfile(parallaxViewCgFragmentProfile_);
//checkForCgError("disabling fragment profile");
glDisable(GL_TEXTURE_2D);
glPopAttrib();
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
if (0)
{
glViewport(0, numY_*tileY_, numX_*tileX_, numY_*tileY_); //setup viewport for covering depth views
glColor4f(1.0, 1.0, 1.0, 1.0);
glDisable(GL_TEXTURE_2D);
glDisable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glBegin(GL_QUADS);
glVertex2f(-1, -1); glVertex2f(-1, 1); glVertex2f(1, 1); glVertex2f(1, -1);
glEnd();
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glEnable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
}
if (0)
{
glViewport(0, 0, numX_*tileX_, numY_*tileY_); //setup viewport for covering color views
glColor4f(0.5, 0.5, 0.5, 0.5);
glDisable(GL_TEXTURE_2D);
glDisable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glBegin(GL_QUADS);
glVertex2f(-1, -1); glVertex2f(-1, 1); glVertex2f(1, 1); glVertex2f(1, -1);
glEnd();
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glEnable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
}
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, textureID_);
//glFlush();
// glCopyTexSubImage 2D(GL_TEXTURE_2D, 0,0,0,0,0,imwidth,imheight);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, viewTexWidth_, viewTexHeight_);
// printf("I'm here\n");
//checkErrors();
glBindTexture(GL_TEXTURE_2D, textureID_);
glDisable(GL_TEXTURE_2D);
#else //end of disable view render
std::unique_lock<std::mutex> cloudLock(cloudMutex_);
this->drawPointCloud();
haveNewCloud_.store(false);
cloudLock.unlock();
#endif
//Fringe computation
#if 0
float quadRadius = 0.5;
// glViewport(0,0,imwidth,512);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//glClear (GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-quadRadius, quadRadius, -quadRadius, quadRadius, 0, 0.125);
// glOrtho(-512,512-1,-256,256,1,125);
// gluLookAt(0,0,0,0,0,-100,0,1,0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
// glTranslatef(0.0,0.0,-100);
//glViewport(0,0,1280,880);
glViewport(0, 0, displayModeWidth_, displayModeHeight_);
//glTranslatef(0.0, -0.25, 0.0); // JB: what does this do?
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, textureID_);
glDisable(GL_LIGHTING);
cgGLBindProgram(fringePatternCgVertexProgram_);
//checkForCgError2("binding vertex program -fringes");
cgGLEnableProfile(fringePatternCgVertexProfile_);
//checkForCgError2("enabling vertex profile -fringes");
cgGLBindProgram(fringePatternCgFragmentProgram_);
//checkForCgError("binding fragment program");
cgGLEnableProfile(fringePatternCgFragmentProfile_);
//checkForCgError("enabling fragment profile");
cgGLEnableTextureParameter(fringeFragmentArgs_.decal);
// checkForCgError2("enable decal texture0");
// cgGLEnableTextureParameter(myCgFragmentParam_decal1);
// checkForCgError2("enable decal texture1");
//cgUpdateProgramParameters(myCgFragmentProgram2);
glColor3f(1.0f, 1.0f, 1.0f);
glBegin(GL_QUADS);
glNormal3f(0.0f, 0.0f, 1.0f);
glTexCoord4f(0.0f, 1.0f, 0.0f, 1.0f);
glVertex3f(-0.5f, 0.5f, 0.0f);
glTexCoord4f(1.0f, 1.0f, 0.0f, 1.0f);
glVertex3f(0.5f, 0.5f, 0.0f);
glTexCoord4f(1.0f, 0.0f, 0.0f, 1);
glVertex3f(0.5f, -0.5f, 0.0f);
glTexCoord4f(0.0f, 0.0f, 0.0f, 1.0f);
glVertex3f(-0.5f, -0.5f, 0.0f);
glEnd();
glDisable(GL_TEXTURE_2D);
//glBindTexture(GL_TEXTURE_2D, textureID_);
cgGLDisableProfile(parallaxViewCgVertexProfile_);
checkForCgError("disabling vertex profile");
cgGLDisableProfile(parallaxViewCgFragmentProfile_);
checkForCgError("disabling fragment profile");
//glutPostRedisplay();
#endif
glutSwapBuffers();
}
void HoloRenderDSCP2::cleanup()
{
}
void HoloRenderDSCP2::glutDisplay(void)
{
gCurrentDSCP2Instance->display();
}
void HoloRenderDSCP2::glutIdle(void)
{
gCurrentDSCP2Instance->idle();
}
void HoloRenderDSCP2::glutKeyboard(unsigned char c, int x, int y)
{
gCurrentDSCP2Instance->keyboard(c, x, y);
}
void HoloRenderDSCP2::glutCleanup(void)
{
gCurrentDSCP2Instance->cleanup();
}
void HoloRenderDSCP2::drawScene(float *eyePosition, float *modelMatrix_sphere,
float *invModelMatrix_sphere, float *objSpaceLightPosition_sphere,
float *modelMatrix_cone, float *invModelMatrix_cone,
float *objSpaceLightPosition_cone, float h, float v, int drawdepthOn,
float myobject, int viewnumber)
{
// const float lightPosition[4] = { 10*mag+lx,20*mag+ly,-605*mag+lz, 1 };
const float lightPosition[4] = { 1.00, 1.00, 6.05, 1 };
//const float eyePosition[4] = { 0,0,0, 1 };
float translateMatrix[16], rotateMatrix[16], viewMatrix[16],
modelViewMatrix[16], modelViewProjMatrix[16];
float objSpaceEyePosition[4], objSpaceLightPosition[4];
holo::utils::BuildLookAtMatrix(eyePosition[0], eyePosition[1], eyePosition[2], 0, 0,-0.425f, 0, 1, 0, viewMatrix);
/*** Render brass solid sphere ***/
//#ifndef VIEWS_FROM_CLOUD
//setRedPlasticMaterial();
//cgSetBrassMaterial();
//setEmissiveLightColorOnly();
//#endif
cgSetParameter1f(parallaxViewFragmentArgs_.drawDepth, drawdepthOn);
/* Transform world-space eye and light positions to sphere's object-space. */
//transform(objSpaceEyePosition, invModelMatrix_sphere, eyePosition);
cgSetParameter3fv(parallaxViewFragmentArgs_.eyePosition, objSpaceEyePosition);
//transform(objSpaceLightPosition, invModelMatrix_sphere, lightPosition);
cgSetParameter3fv(parallaxViewFragmentArgs_.lightPosition, objSpaceLightPosition_sphere);
holo::utils::MultMatrix(modelViewProjMatrix, projectionMatrix1_, modelMatrix_sphere);
//holo::utils::MultMatrix(modelViewMatrix, viewMatrix, modelMatrix_sphere);
//holo::utils::MultMatrix(modelViewProjMatrix, projectionMatrix1_, modelViewMatrix);
// glEnable(GL_LIGHTING);
//glEnable(GL_TEXTURE_2D);
//glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo); // bind the frame buffer object
//glViewport(h,v,64,440);
/* Set matrix parameter with row-major matrix. */
cgSetMatrixParameterfr(parallaxViewVertexArgs_.modelViewProj, modelViewProjMatrix);
cgUpdateProgramParameters(parallaxViewCgVertexProgram_);
this->drawPointCloud();
//glDisable(GL_TEXTURE_2D);
//this->drawPointCloud();
}
void HoloRenderDSCP2::drawPointCloud()
{
//if (haveNewCloud_.load())
//{
//glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//std::lock_guard<std::mutex> lg(cloudMutex_);
const int ystride = 1; //only render every ystride lines
const float gain = 1 / 256.0; // converting from char units to float
//glEnable(GL_TEXTURE_2D);
glEnable(GL_POINT_SMOOTH);
glPointSize(1.0f);
//float attenparams[3] = {0,0,0}; //a b c //size ? 1 a + b ? d + c ? d 2
//glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION,attenparams);
glBegin(GL_POINTS);
HoloPoint3D *pointIdx = cloud_->points.data();
float luma = 0.0f;
for (int i = 0; i < cloud_->size(); i+=ystride)
{
if (pointIdx->z == HOLO_CLOUD_BAD_POINT)
continue;
luma = (pointIdx->r + pointIdx->g + pointIdx->b)/3 * gain;
glVertex4f(pointIdx->x, -pointIdx->y, pointIdx->z, 1.0f);
glColor3f(luma, luma, luma);
pointIdx+=ystride;
}
glEnd();
glDisable(GL_POINT_SMOOTH);
//glDisable(GL_TEXTURE_2D);
//haveNewCloud_.store(false);
//glutPostRedisplay();
//}
}
void HoloRenderDSCP2::drawString(float posX, float posY, std::string theString)
{
glRasterPos2f(posX, posY);
for (int i = 0; i < theString.size(); i++)
{
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, theString[i]);
}
}
bool HoloRenderDSCP2::checkForCgErrorLine(const char *situation, int line)
{
CGerror error;
const char *string = cgGetLastErrorString(&error);
if (error != CG_NO_ERROR)
{
LOG4CXX_ERROR(logger_, situation << ": " << string);
if (error == CG_COMPILER_ERROR)
{
LOG4CXX_ERROR(logger_, "Cg compiler error: " << cgGetLastListing(cgContext_));
exit(-1);
}
return true;
}
return false;
}
bool HoloRenderDSCP2::checkForCgError(const char *situation)
{
return checkForCgErrorLine(situation, __LINE__);
}
bool HoloRenderDSCP2::checkForCgError2(const char *situation)
{
CGerror error;
const char *string = cgGetLastErrorString(&error);
if (error != CG_NO_ERROR)
{
LOG4CXX_ERROR(logger_, situation << ": " << string);
if (error == CG_COMPILER_ERROR)
{
LOG4CXX_ERROR(logger_, "Cg compiler error: " << cgGetLastListing(cgContext_));
}
return true;
}
return false;
}
void HoloRenderDSCP2::cgSetBrassMaterial(){
const float brassEmissive[3] =
{ 0.0, 0.0, 0.0 }, brassAmbient[3] =
{ 0.33 * 2, 0.33 * 2, 0.33 * 2 }, brassDiffuse[3] =
{ 0.78, 0.78, 0.78 }, brassSpecular[3] =
{ 0.99, 0.99, 0.99 }, brassShininess = 27.8;
cgSetParameter3fv(parallaxViewFragmentArgs_.ke, brassEmissive);
cgSetParameter3fv(parallaxViewFragmentArgs_.ka, brassAmbient);
cgSetParameter3fv(parallaxViewFragmentArgs_.kd, brassDiffuse);
cgSetParameter3fv(parallaxViewFragmentArgs_.ks, brassSpecular);
cgSetParameter1f(parallaxViewFragmentArgs_.shininess, brassShininess);
}
void HoloRenderDSCP2::cgSetRedPlasticMaterial()
{
const float redPlasticEmissive[3] =
{ 0.0, 0.0, 0.0 }, redPlasticAmbient[3] =
{ 0.2, 0.2, 0.2 }, redPlasticDiffuse[3] =
{ 0.5, 0.5, 0.5 }, redPlasticSpecular[3] =
{ 0.6, 0.6, 0.6 }, redPlasticShininess = 32.0;
cgSetParameter3fv(parallaxViewFragmentArgs_.ke, redPlasticEmissive);
checkForCgError("setting Ke parameter");
cgSetParameter3fv(parallaxViewFragmentArgs_.ka, redPlasticAmbient);
checkForCgError("setting Ka parameter");
cgSetParameter3fv(parallaxViewFragmentArgs_.kd, redPlasticDiffuse);
checkForCgError("setting Kd parameter");
cgSetParameter3fv(parallaxViewFragmentArgs_.ks, redPlasticSpecular);
checkForCgError("setting Ks parameter");
cgSetParameter1f(parallaxViewFragmentArgs_.shininess, redPlasticShininess);
checkForCgError("setting shininess parameter");
}
void HoloRenderDSCP2::cgSetEmissiveLightColorOnly()
{
const float zero[3] = { 0.0, 0.0, 0.0 };
cgSetParameter3fv(parallaxViewFragmentArgs_.ke, lightColor_);
checkForCgError("setting Ke parameter");
cgSetParameter3fv(parallaxViewFragmentArgs_.ka, zero);
checkForCgError("setting Ka parameter");
cgSetParameter3fv(parallaxViewFragmentArgs_.kd, zero);
checkForCgError("setting Kd parameter");
cgSetParameter3fv(parallaxViewFragmentArgs_.ks, zero);
checkForCgError("setting Ks parameter");
cgSetParameter1f(parallaxViewFragmentArgs_.shininess, 0);
checkForCgError("setting shininess parameter");
}
void HoloRenderDSCP2::deinit()
{
}
void HoloRenderDSCP2::updateRemotePointCloud(HoloCloudPtr && pointCloud)
{
std::lock_guard<std::mutex> lg(cloudMutex_);
cloud_ = std::move(pointCloud);
haveNewCloud_.store(true);
}
void HoloRenderDSCP2::updateLocalPointCloud(HoloCloudPtr && pointCloud)
{
}
#endif
|
\subsection{For the explorer}
\label{sec:explorer}
As is the case with GDR the role of observer and explorer are conflated in that
the explorer can change the graph instance via the same interface as running the
algorithm. As already pointed out, that same interface provides conveniences
to the animator as well.
\cmt{Note that the observer role differs from the explorer only in that the
observer fails to take advantage of editing the graph, a limitation that is
anticipated only for users not familiar with graphs; deal with this point
under UI below?}
% [Last modified: 2013 06 04 at 19:13:02 GMT]
|
SUBROUTINE DCROSS(X,Y,Z)
C
C DOUBLE PRECISION CROSS PRODUCT
C
DOUBLE PRECISION X(3) ,Y(3) ,Z(3)
C
Z(1) = X(2)*Y(3) - X(3)*Y(2)
Z(2) = Y(1)*X(3) - Y(3)*X(1)
Z(3) = X(1)*Y(2) - X(2)*Y(1)
RETURN
END
|
[STATEMENT]
lemma a_\<beta>:
assumes linp: "iszlfm p"
and d: "d_\<beta> p l"
and lp: "l > 0"
shows "iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p
[PROOF STEP]
using linp d
[PROOF STATE]
proof (prove)
using this:
iszlfm p
d_\<beta> p l
goal (1 subgoal):
1. iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p
[PROOF STEP]
proof (induct p rule: iszlfm.induct)
[PROOF STATE]
proof (state)
goal (75 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Lt (CN 0 c e)); d_\<beta> (Lt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN 0 c e)) l) = Ifm bbs (x # bs) (Lt (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Le (CN 0 c e)); d_\<beta> (Le (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
7. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
8. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
9. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
10. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
A total of 75 subgoals...
[PROOF STEP]
case (5 c e)
[PROOF STATE]
proof (state)
this:
iszlfm (Lt (CN 0 c e))
d_\<beta> (Lt (CN 0 c e)) l
goal (75 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Lt (CN 0 c e)); d_\<beta> (Lt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN 0 c e)) l) = Ifm bbs (x # bs) (Lt (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Le (CN 0 c e)); d_\<beta> (Le (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
7. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
8. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
9. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
10. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
A total of 75 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
iszlfm (Lt (CN 0 c e))
d_\<beta> (Lt (CN 0 c e)) l
[PROOF STEP]
have cp: "c > 0" and be: "numbound0 e" and d': "c dvd l"
[PROOF STATE]
proof (prove)
using this:
iszlfm (Lt (CN 0 c e))
d_\<beta> (Lt (CN 0 c e)) l
goal (1 subgoal):
1. 0 < c &&& numbound0 e &&& c dvd l
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
0 < c
numbound0 e
c dvd l
goal (75 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Lt (CN 0 c e)); d_\<beta> (Lt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN 0 c e)) l) = Ifm bbs (x # bs) (Lt (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Le (CN 0 c e)); d_\<beta> (Le (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
7. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
8. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
9. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
10. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
A total of 75 subgoals...
[PROOF STEP]
from lp cp
[PROOF STATE]
proof (chain)
picking this:
0 < l
0 < c
[PROOF STEP]
have clel: "c \<le> l"
[PROOF STATE]
proof (prove)
using this:
0 < l
0 < c
goal (1 subgoal):
1. c \<le> l
[PROOF STEP]
by (simp add: zdvd_imp_le [OF d' lp])
[PROOF STATE]
proof (state)
this:
c \<le> l
goal (75 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Lt (CN 0 c e)); d_\<beta> (Lt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN 0 c e)) l) = Ifm bbs (x # bs) (Lt (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Le (CN 0 c e)); d_\<beta> (Le (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
7. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
8. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
9. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
10. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
A total of 75 subgoals...
[PROOF STEP]
from cp
[PROOF STATE]
proof (chain)
picking this:
0 < c
[PROOF STEP]
have cnz: "c \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
0 < c
goal (1 subgoal):
1. c \<noteq> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c \<noteq> 0
goal (75 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Lt (CN 0 c e)); d_\<beta> (Lt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN 0 c e)) l) = Ifm bbs (x # bs) (Lt (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Le (CN 0 c e)); d_\<beta> (Le (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
7. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
8. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
9. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
10. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
A total of 75 subgoals...
[PROOF STEP]
have "c div c \<le> l div c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. c div c \<le> l div c
[PROOF STEP]
by (simp add: zdiv_mono1[OF clel cp])
[PROOF STATE]
proof (state)
this:
c div c \<le> l div c
goal (75 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Lt (CN 0 c e)); d_\<beta> (Lt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN 0 c e)) l) = Ifm bbs (x # bs) (Lt (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Le (CN 0 c e)); d_\<beta> (Le (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
7. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
8. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
9. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
10. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
A total of 75 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c div c \<le> l div c
[PROOF STEP]
have ldcp: "0 < l div c"
[PROOF STATE]
proof (prove)
using this:
c div c \<le> l div c
goal (1 subgoal):
1. 0 < l div c
[PROOF STEP]
by (simp add: div_self[OF cnz])
[PROOF STATE]
proof (state)
this:
0 < l div c
goal (75 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Lt (CN 0 c e)); d_\<beta> (Lt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN 0 c e)) l) = Ifm bbs (x # bs) (Lt (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Le (CN 0 c e)); d_\<beta> (Le (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
7. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
8. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
9. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
10. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
A total of 75 subgoals...
[PROOF STEP]
have "c * (l div c) = c * (l div c) + l mod c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. c * (l div c) = c * (l div c) + l mod c
[PROOF STEP]
using d' dvd_eq_mod_eq_0[of "c" "l"]
[PROOF STATE]
proof (prove)
using this:
c dvd l
(c dvd l) = (l mod c = 0)
goal (1 subgoal):
1. c * (l div c) = c * (l div c) + l mod c
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c * (l div c) = c * (l div c) + l mod c
goal (75 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Lt (CN 0 c e)); d_\<beta> (Lt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN 0 c e)) l) = Ifm bbs (x # bs) (Lt (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Le (CN 0 c e)); d_\<beta> (Le (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
7. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
8. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
9. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
10. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
A total of 75 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c * (l div c) = c * (l div c) + l mod c
[PROOF STEP]
have cl: "c * (l div c) =l"
[PROOF STATE]
proof (prove)
using this:
c * (l div c) = c * (l div c) + l mod c
goal (1 subgoal):
1. c * (l div c) = l
[PROOF STEP]
using mult_div_mod_eq [where a="l" and b="c"]
[PROOF STATE]
proof (prove)
using this:
c * (l div c) = c * (l div c) + l mod c
c * (l div c) + l mod c = l
goal (1 subgoal):
1. c * (l div c) = l
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c * (l div c) = l
goal (75 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Lt (CN 0 c e)); d_\<beta> (Lt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN 0 c e)) l) = Ifm bbs (x # bs) (Lt (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Le (CN 0 c e)); d_\<beta> (Le (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
7. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
8. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
9. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
10. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
A total of 75 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c * (l div c) = l
[PROOF STEP]
have "(l * x + (l div c) * Inum (x # bs) e < 0) \<longleftrightarrow>
((c * (l div c)) * x + (l div c) * Inum (x # bs) e < 0)"
[PROOF STATE]
proof (prove)
using this:
c * (l div c) = l
goal (1 subgoal):
1. (l * x + l div c * Inum (x # bs) e < 0) = (c * (l div c) * x + l div c * Inum (x # bs) e < 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(l * x + l div c * Inum (x # bs) e < 0) = (c * (l div c) * x + l div c * Inum (x # bs) e < 0)
goal (75 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Lt (CN 0 c e)); d_\<beta> (Lt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN 0 c e)) l) = Ifm bbs (x # bs) (Lt (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Le (CN 0 c e)); d_\<beta> (Le (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
7. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
8. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
9. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
10. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
A total of 75 subgoals...
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(l * x + l div c * Inum (x # bs) e < 0) = (c * (l div c) * x + l div c * Inum (x # bs) e < 0)
goal (75 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Lt (CN 0 c e)); d_\<beta> (Lt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN 0 c e)) l) = Ifm bbs (x # bs) (Lt (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Le (CN 0 c e)); d_\<beta> (Le (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
7. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
8. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
9. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
10. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
A total of 75 subgoals...
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (l div c) * (c * x + Inum (x # bs) e) < (l div c) * 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (c * (l div c) * x + l div c * Inum (x # bs) e < 0) = (l div c * (c * x + Inum (x # bs) e) < l div c * 0)
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
(c * (l div c) * x + l div c * Inum (x # bs) e < 0) = (l div c * (c * x + Inum (x # bs) e) < l div c * 0)
goal (75 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Lt (CN 0 c e)); d_\<beta> (Lt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN 0 c e)) l) = Ifm bbs (x # bs) (Lt (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Le (CN 0 c e)); d_\<beta> (Le (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
7. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
8. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
9. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
10. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
A total of 75 subgoals...
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(c * (l div c) * x + l div c * Inum (x # bs) e < 0) = (l div c * (c * x + Inum (x # bs) e) < l div c * 0)
goal (75 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Lt (CN 0 c e)); d_\<beta> (Lt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN 0 c e)) l) = Ifm bbs (x # bs) (Lt (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Le (CN 0 c e)); d_\<beta> (Le (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
7. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
8. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
9. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
10. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
A total of 75 subgoals...
[PROOF STEP]
have "\<dots> \<longleftrightarrow> c * x + Inum (x # bs) e < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (l div c * (c * x + Inum (x # bs) e) < l div c * 0) = (c * x + Inum (x # bs) e < 0)
[PROOF STEP]
using mult_less_0_iff [where a="(l div c)" and b="c*x + Inum (x # bs) e"] ldcp
[PROOF STATE]
proof (prove)
using this:
(l div c * (c * x + Inum (x # bs) e) < 0) = (0 < l div c \<and> c * x + Inum (x # bs) e < 0 \<or> l div c < 0 \<and> 0 < c * x + Inum (x # bs) e)
0 < l div c
goal (1 subgoal):
1. (l div c * (c * x + Inum (x # bs) e) < l div c * 0) = (c * x + Inum (x # bs) e < 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(l div c * (c * x + Inum (x # bs) e) < l div c * 0) = (c * x + Inum (x # bs) e < 0)
goal (75 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Lt (CN 0 c e)); d_\<beta> (Lt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN 0 c e)) l) = Ifm bbs (x # bs) (Lt (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Le (CN 0 c e)); d_\<beta> (Le (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
7. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
8. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
9. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
10. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
A total of 75 subgoals...
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(l * x + l div c * Inum (x # bs) e < 0) = (c * x + Inum (x # bs) e < 0)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(l * x + l div c * Inum (x # bs) e < 0) = (c * x + Inum (x # bs) e < 0)
goal (1 subgoal):
1. iszlfm (a_\<beta> (Lt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN 0 c e)) l) = Ifm bbs (x # bs) (Lt (CN 0 c e))
[PROOF STEP]
using numbound0_I[OF be,where b="l*x" and b'="x" and bs="bs"] be
[PROOF STATE]
proof (prove)
using this:
(l * x + l div c * Inum (x # bs) e < 0) = (c * x + Inum (x # bs) e < 0)
Inum (l * x # bs) e = Inum (x # bs) e
numbound0 e
goal (1 subgoal):
1. iszlfm (a_\<beta> (Lt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN 0 c e)) l) = Ifm bbs (x # bs) (Lt (CN 0 c e))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
iszlfm (a_\<beta> (Lt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN 0 c e)) l) = Ifm bbs (x # bs) (Lt (CN 0 c e))
goal (74 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Le (CN 0 c e)); d_\<beta> (Le (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
7. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
8. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
9. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
10. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
A total of 74 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (74 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Le (CN 0 c e)); d_\<beta> (Le (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
7. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
8. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
9. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
10. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
A total of 74 subgoals...
[PROOF STEP]
case (6 c e)
[PROOF STATE]
proof (state)
this:
iszlfm (Le (CN 0 c e))
d_\<beta> (Le (CN 0 c e)) l
goal (74 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Le (CN 0 c e)); d_\<beta> (Le (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
7. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
8. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
9. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
10. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
A total of 74 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
iszlfm (Le (CN 0 c e))
d_\<beta> (Le (CN 0 c e)) l
[PROOF STEP]
have cp: "c > 0" and be: "numbound0 e" and d': "c dvd l"
[PROOF STATE]
proof (prove)
using this:
iszlfm (Le (CN 0 c e))
d_\<beta> (Le (CN 0 c e)) l
goal (1 subgoal):
1. 0 < c &&& numbound0 e &&& c dvd l
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
0 < c
numbound0 e
c dvd l
goal (74 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Le (CN 0 c e)); d_\<beta> (Le (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
7. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
8. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
9. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
10. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
A total of 74 subgoals...
[PROOF STEP]
from lp cp
[PROOF STATE]
proof (chain)
picking this:
0 < l
0 < c
[PROOF STEP]
have clel: "c \<le> l"
[PROOF STATE]
proof (prove)
using this:
0 < l
0 < c
goal (1 subgoal):
1. c \<le> l
[PROOF STEP]
by (simp add: zdvd_imp_le [OF d' lp])
[PROOF STATE]
proof (state)
this:
c \<le> l
goal (74 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Le (CN 0 c e)); d_\<beta> (Le (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
7. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
8. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
9. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
10. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
A total of 74 subgoals...
[PROOF STEP]
from cp
[PROOF STATE]
proof (chain)
picking this:
0 < c
[PROOF STEP]
have cnz: "c \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
0 < c
goal (1 subgoal):
1. c \<noteq> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c \<noteq> 0
goal (74 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Le (CN 0 c e)); d_\<beta> (Le (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
7. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
8. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
9. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
10. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
A total of 74 subgoals...
[PROOF STEP]
have "c div c \<le> l div c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. c div c \<le> l div c
[PROOF STEP]
by (simp add: zdiv_mono1[OF clel cp])
[PROOF STATE]
proof (state)
this:
c div c \<le> l div c
goal (74 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Le (CN 0 c e)); d_\<beta> (Le (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
7. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
8. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
9. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
10. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
A total of 74 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c div c \<le> l div c
[PROOF STEP]
have ldcp:"0 < l div c"
[PROOF STATE]
proof (prove)
using this:
c div c \<le> l div c
goal (1 subgoal):
1. 0 < l div c
[PROOF STEP]
by (simp add: div_self[OF cnz])
[PROOF STATE]
proof (state)
this:
0 < l div c
goal (74 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Le (CN 0 c e)); d_\<beta> (Le (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
7. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
8. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
9. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
10. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
A total of 74 subgoals...
[PROOF STEP]
have "c * (l div c) = c * (l div c) + l mod c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. c * (l div c) = c * (l div c) + l mod c
[PROOF STEP]
using d' dvd_eq_mod_eq_0[of "c" "l"]
[PROOF STATE]
proof (prove)
using this:
c dvd l
(c dvd l) = (l mod c = 0)
goal (1 subgoal):
1. c * (l div c) = c * (l div c) + l mod c
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c * (l div c) = c * (l div c) + l mod c
goal (74 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Le (CN 0 c e)); d_\<beta> (Le (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
7. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
8. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
9. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
10. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
A total of 74 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c * (l div c) = c * (l div c) + l mod c
[PROOF STEP]
have cl: "c * (l div c) = l"
[PROOF STATE]
proof (prove)
using this:
c * (l div c) = c * (l div c) + l mod c
goal (1 subgoal):
1. c * (l div c) = l
[PROOF STEP]
using mult_div_mod_eq [where a="l" and b="c"]
[PROOF STATE]
proof (prove)
using this:
c * (l div c) = c * (l div c) + l mod c
c * (l div c) + l mod c = l
goal (1 subgoal):
1. c * (l div c) = l
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c * (l div c) = l
goal (74 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Le (CN 0 c e)); d_\<beta> (Le (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
7. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
8. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
9. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
10. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
A total of 74 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c * (l div c) = l
[PROOF STEP]
have "l * x + (l div c) * Inum (x # bs) e \<le> 0 \<longleftrightarrow>
(c * (l div c)) * x + (l div c) * Inum (x # bs) e \<le> 0"
[PROOF STATE]
proof (prove)
using this:
c * (l div c) = l
goal (1 subgoal):
1. (l * x + l div c * Inum (x # bs) e \<le> 0) = (c * (l div c) * x + l div c * Inum (x # bs) e \<le> 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(l * x + l div c * Inum (x # bs) e \<le> 0) = (c * (l div c) * x + l div c * Inum (x # bs) e \<le> 0)
goal (74 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Le (CN 0 c e)); d_\<beta> (Le (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
7. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
8. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
9. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
10. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
A total of 74 subgoals...
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(l * x + l div c * Inum (x # bs) e \<le> 0) = (c * (l div c) * x + l div c * Inum (x # bs) e \<le> 0)
goal (74 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Le (CN 0 c e)); d_\<beta> (Le (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
7. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
8. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
9. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
10. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
A total of 74 subgoals...
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (l div c) * (c * x + Inum (x # bs) e) \<le> (l div c) * 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (c * (l div c) * x + l div c * Inum (x # bs) e \<le> 0) = (l div c * (c * x + Inum (x # bs) e) \<le> l div c * 0)
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
(c * (l div c) * x + l div c * Inum (x # bs) e \<le> 0) = (l div c * (c * x + Inum (x # bs) e) \<le> l div c * 0)
goal (74 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Le (CN 0 c e)); d_\<beta> (Le (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
7. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
8. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
9. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
10. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
A total of 74 subgoals...
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(c * (l div c) * x + l div c * Inum (x # bs) e \<le> 0) = (l div c * (c * x + Inum (x # bs) e) \<le> l div c * 0)
goal (74 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Le (CN 0 c e)); d_\<beta> (Le (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
7. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
8. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
9. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
10. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
A total of 74 subgoals...
[PROOF STEP]
have "\<dots> \<longleftrightarrow> c * x + Inum (x # bs) e \<le> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (l div c * (c * x + Inum (x # bs) e) \<le> l div c * 0) = (c * x + Inum (x # bs) e \<le> 0)
[PROOF STEP]
using mult_le_0_iff [where a="(l div c)" and b="c*x + Inum (x # bs) e"] ldcp
[PROOF STATE]
proof (prove)
using this:
(l div c * (c * x + Inum (x # bs) e) \<le> 0) = (0 \<le> l div c \<and> c * x + Inum (x # bs) e \<le> 0 \<or> l div c \<le> 0 \<and> 0 \<le> c * x + Inum (x # bs) e)
0 < l div c
goal (1 subgoal):
1. (l div c * (c * x + Inum (x # bs) e) \<le> l div c * 0) = (c * x + Inum (x # bs) e \<le> 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(l div c * (c * x + Inum (x # bs) e) \<le> l div c * 0) = (c * x + Inum (x # bs) e \<le> 0)
goal (74 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Le (CN 0 c e)); d_\<beta> (Le (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
7. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
8. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
9. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
10. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
A total of 74 subgoals...
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(l * x + l div c * Inum (x # bs) e \<le> 0) = (c * x + Inum (x # bs) e \<le> 0)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(l * x + l div c * Inum (x # bs) e \<le> 0) = (c * x + Inum (x # bs) e \<le> 0)
goal (1 subgoal):
1. iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
[PROOF STEP]
using numbound0_I[OF be,where b="l*x" and b'="x" and bs="bs"] be
[PROOF STATE]
proof (prove)
using this:
(l * x + l div c * Inum (x # bs) e \<le> 0) = (c * x + Inum (x # bs) e \<le> 0)
Inum (l * x # bs) e = Inum (x # bs) e
numbound0 e
goal (1 subgoal):
1. iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
iszlfm (a_\<beta> (Le (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Le (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Le (CN 0 c e)) l) = Ifm bbs (x # bs) (Le (CN 0 c e))
goal (73 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
7. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
8. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
9. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
10. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
A total of 73 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (73 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
7. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
8. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
9. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
10. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
A total of 73 subgoals...
[PROOF STEP]
case (7 c e)
[PROOF STATE]
proof (state)
this:
iszlfm (Gt (CN 0 c e))
d_\<beta> (Gt (CN 0 c e)) l
goal (73 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
7. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
8. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
9. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
10. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
A total of 73 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
iszlfm (Gt (CN 0 c e))
d_\<beta> (Gt (CN 0 c e)) l
[PROOF STEP]
have cp: "c > 0" and be: "numbound0 e" and d': "c dvd l"
[PROOF STATE]
proof (prove)
using this:
iszlfm (Gt (CN 0 c e))
d_\<beta> (Gt (CN 0 c e)) l
goal (1 subgoal):
1. 0 < c &&& numbound0 e &&& c dvd l
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
0 < c
numbound0 e
c dvd l
goal (73 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
7. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
8. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
9. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
10. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
A total of 73 subgoals...
[PROOF STEP]
from lp cp
[PROOF STATE]
proof (chain)
picking this:
0 < l
0 < c
[PROOF STEP]
have clel: "c \<le> l"
[PROOF STATE]
proof (prove)
using this:
0 < l
0 < c
goal (1 subgoal):
1. c \<le> l
[PROOF STEP]
by (simp add: zdvd_imp_le [OF d' lp])
[PROOF STATE]
proof (state)
this:
c \<le> l
goal (73 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
7. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
8. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
9. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
10. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
A total of 73 subgoals...
[PROOF STEP]
from cp
[PROOF STATE]
proof (chain)
picking this:
0 < c
[PROOF STEP]
have cnz: "c \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
0 < c
goal (1 subgoal):
1. c \<noteq> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c \<noteq> 0
goal (73 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
7. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
8. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
9. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
10. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
A total of 73 subgoals...
[PROOF STEP]
have "c div c \<le> l div c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. c div c \<le> l div c
[PROOF STEP]
by (simp add: zdiv_mono1[OF clel cp])
[PROOF STATE]
proof (state)
this:
c div c \<le> l div c
goal (73 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
7. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
8. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
9. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
10. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
A total of 73 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c div c \<le> l div c
[PROOF STEP]
have ldcp: "0 < l div c"
[PROOF STATE]
proof (prove)
using this:
c div c \<le> l div c
goal (1 subgoal):
1. 0 < l div c
[PROOF STEP]
by (simp add: div_self[OF cnz])
[PROOF STATE]
proof (state)
this:
0 < l div c
goal (73 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
7. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
8. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
9. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
10. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
A total of 73 subgoals...
[PROOF STEP]
have "c * (l div c) = c * (l div c) + l mod c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. c * (l div c) = c * (l div c) + l mod c
[PROOF STEP]
using d' dvd_eq_mod_eq_0[of "c" "l"]
[PROOF STATE]
proof (prove)
using this:
c dvd l
(c dvd l) = (l mod c = 0)
goal (1 subgoal):
1. c * (l div c) = c * (l div c) + l mod c
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c * (l div c) = c * (l div c) + l mod c
goal (73 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
7. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
8. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
9. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
10. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
A total of 73 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c * (l div c) = c * (l div c) + l mod c
[PROOF STEP]
have cl: "c * (l div c) = l"
[PROOF STATE]
proof (prove)
using this:
c * (l div c) = c * (l div c) + l mod c
goal (1 subgoal):
1. c * (l div c) = l
[PROOF STEP]
using mult_div_mod_eq [where a="l" and b="c"]
[PROOF STATE]
proof (prove)
using this:
c * (l div c) = c * (l div c) + l mod c
c * (l div c) + l mod c = l
goal (1 subgoal):
1. c * (l div c) = l
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c * (l div c) = l
goal (73 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
7. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
8. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
9. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
10. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
A total of 73 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c * (l div c) = l
[PROOF STEP]
have "l * x + (l div c) * Inum (x # bs) e > 0 \<longleftrightarrow>
(c * (l div c)) * x + (l div c) * Inum (x # bs) e > 0"
[PROOF STATE]
proof (prove)
using this:
c * (l div c) = l
goal (1 subgoal):
1. (0 < l * x + l div c * Inum (x # bs) e) = (0 < c * (l div c) * x + l div c * Inum (x # bs) e)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(0 < l * x + l div c * Inum (x # bs) e) = (0 < c * (l div c) * x + l div c * Inum (x # bs) e)
goal (73 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
7. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
8. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
9. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
10. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
A total of 73 subgoals...
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(0 < l * x + l div c * Inum (x # bs) e) = (0 < c * (l div c) * x + l div c * Inum (x # bs) e)
goal (73 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
7. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
8. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
9. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
10. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
A total of 73 subgoals...
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (l div c) * (c * x + Inum (x # bs) e) > (l div c) * 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (0 < c * (l div c) * x + l div c * Inum (x # bs) e) = (l div c * 0 < l div c * (c * x + Inum (x # bs) e))
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
(0 < c * (l div c) * x + l div c * Inum (x # bs) e) = (l div c * 0 < l div c * (c * x + Inum (x # bs) e))
goal (73 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
7. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
8. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
9. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
10. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
A total of 73 subgoals...
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(0 < c * (l div c) * x + l div c * Inum (x # bs) e) = (l div c * 0 < l div c * (c * x + Inum (x # bs) e))
goal (73 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
7. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
8. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
9. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
10. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
A total of 73 subgoals...
[PROOF STEP]
have "\<dots> \<longleftrightarrow> c * x + Inum (x # bs) e > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (l div c * 0 < l div c * (c * x + Inum (x # bs) e)) = (0 < c * x + Inum (x # bs) e)
[PROOF STEP]
using zero_less_mult_iff [where a="(l div c)" and b="c * x + Inum (x # bs) e"] ldcp
[PROOF STATE]
proof (prove)
using this:
(0 < l div c * (c * x + Inum (x # bs) e)) = (0 < l div c \<and> 0 < c * x + Inum (x # bs) e \<or> l div c < 0 \<and> c * x + Inum (x # bs) e < 0)
0 < l div c
goal (1 subgoal):
1. (l div c * 0 < l div c * (c * x + Inum (x # bs) e)) = (0 < c * x + Inum (x # bs) e)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(l div c * 0 < l div c * (c * x + Inum (x # bs) e)) = (0 < c * x + Inum (x # bs) e)
goal (73 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Gt (CN 0 c e)); d_\<beta> (Gt (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
6. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
7. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
8. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
9. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
10. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
A total of 73 subgoals...
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(0 < l * x + l div c * Inum (x # bs) e) = (0 < c * x + Inum (x # bs) e)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(0 < l * x + l div c * Inum (x # bs) e) = (0 < c * x + Inum (x # bs) e)
goal (1 subgoal):
1. iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
[PROOF STEP]
using numbound0_I[OF be,where b="(l * x)" and b'="x" and bs="bs"] be
[PROOF STATE]
proof (prove)
using this:
(0 < l * x + l div c * Inum (x # bs) e) = (0 < c * x + Inum (x # bs) e)
Inum (l * x # bs) e = Inum (x # bs) e
numbound0 e
goal (1 subgoal):
1. iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
iszlfm (a_\<beta> (Gt (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Gt (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Gt (CN 0 c e)) l) = Ifm bbs (x # bs) (Gt (CN 0 c e))
goal (72 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
6. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
7. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
8. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
9. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
10. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
A total of 72 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (72 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
6. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
7. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
8. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
9. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
10. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
A total of 72 subgoals...
[PROOF STEP]
case (8 c e)
[PROOF STATE]
proof (state)
this:
iszlfm (Ge (CN 0 c e))
d_\<beta> (Ge (CN 0 c e)) l
goal (72 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
6. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
7. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
8. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
9. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
10. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
A total of 72 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
iszlfm (Ge (CN 0 c e))
d_\<beta> (Ge (CN 0 c e)) l
[PROOF STEP]
have cp: "c > 0" and be: "numbound0 e" and d': "c dvd l"
[PROOF STATE]
proof (prove)
using this:
iszlfm (Ge (CN 0 c e))
d_\<beta> (Ge (CN 0 c e)) l
goal (1 subgoal):
1. 0 < c &&& numbound0 e &&& c dvd l
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
0 < c
numbound0 e
c dvd l
goal (72 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
6. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
7. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
8. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
9. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
10. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
A total of 72 subgoals...
[PROOF STEP]
from lp cp
[PROOF STATE]
proof (chain)
picking this:
0 < l
0 < c
[PROOF STEP]
have clel: "c \<le> l"
[PROOF STATE]
proof (prove)
using this:
0 < l
0 < c
goal (1 subgoal):
1. c \<le> l
[PROOF STEP]
by (simp add: zdvd_imp_le [OF d' lp])
[PROOF STATE]
proof (state)
this:
c \<le> l
goal (72 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
6. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
7. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
8. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
9. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
10. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
A total of 72 subgoals...
[PROOF STEP]
from cp
[PROOF STATE]
proof (chain)
picking this:
0 < c
[PROOF STEP]
have cnz: "c \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
0 < c
goal (1 subgoal):
1. c \<noteq> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c \<noteq> 0
goal (72 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
6. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
7. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
8. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
9. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
10. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
A total of 72 subgoals...
[PROOF STEP]
have "c div c \<le> l div c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. c div c \<le> l div c
[PROOF STEP]
by (simp add: zdiv_mono1[OF clel cp])
[PROOF STATE]
proof (state)
this:
c div c \<le> l div c
goal (72 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
6. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
7. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
8. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
9. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
10. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
A total of 72 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c div c \<le> l div c
[PROOF STEP]
have ldcp: "0 < l div c"
[PROOF STATE]
proof (prove)
using this:
c div c \<le> l div c
goal (1 subgoal):
1. 0 < l div c
[PROOF STEP]
by (simp add: div_self[OF cnz])
[PROOF STATE]
proof (state)
this:
0 < l div c
goal (72 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
6. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
7. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
8. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
9. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
10. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
A total of 72 subgoals...
[PROOF STEP]
have "c * (l div c) = c * (l div c) + l mod c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. c * (l div c) = c * (l div c) + l mod c
[PROOF STEP]
using d' dvd_eq_mod_eq_0[of "c" "l"]
[PROOF STATE]
proof (prove)
using this:
c dvd l
(c dvd l) = (l mod c = 0)
goal (1 subgoal):
1. c * (l div c) = c * (l div c) + l mod c
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c * (l div c) = c * (l div c) + l mod c
goal (72 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
6. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
7. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
8. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
9. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
10. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
A total of 72 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c * (l div c) = c * (l div c) + l mod c
[PROOF STEP]
have cl: "c * (l div c) =l"
[PROOF STATE]
proof (prove)
using this:
c * (l div c) = c * (l div c) + l mod c
goal (1 subgoal):
1. c * (l div c) = l
[PROOF STEP]
using mult_div_mod_eq [where a="l" and b="c"]
[PROOF STATE]
proof (prove)
using this:
c * (l div c) = c * (l div c) + l mod c
c * (l div c) + l mod c = l
goal (1 subgoal):
1. c * (l div c) = l
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c * (l div c) = l
goal (72 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
6. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
7. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
8. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
9. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
10. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
A total of 72 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c * (l div c) = l
[PROOF STEP]
have "l * x + (l div c) * Inum (x # bs) e \<ge> 0 \<longleftrightarrow>
(c * (l div c)) * x + (l div c) * Inum (x # bs) e \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
c * (l div c) = l
goal (1 subgoal):
1. (0 \<le> l * x + l div c * Inum (x # bs) e) = (0 \<le> c * (l div c) * x + l div c * Inum (x # bs) e)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(0 \<le> l * x + l div c * Inum (x # bs) e) = (0 \<le> c * (l div c) * x + l div c * Inum (x # bs) e)
goal (72 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
6. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
7. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
8. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
9. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
10. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
A total of 72 subgoals...
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(0 \<le> l * x + l div c * Inum (x # bs) e) = (0 \<le> c * (l div c) * x + l div c * Inum (x # bs) e)
goal (72 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
6. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
7. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
8. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
9. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
10. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
A total of 72 subgoals...
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (l div c) * (c * x + Inum (x # bs) e) \<ge> (l div c) * 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (0 \<le> c * (l div c) * x + l div c * Inum (x # bs) e) = (l div c * 0 \<le> l div c * (c * x + Inum (x # bs) e))
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
(0 \<le> c * (l div c) * x + l div c * Inum (x # bs) e) = (l div c * 0 \<le> l div c * (c * x + Inum (x # bs) e))
goal (72 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
6. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
7. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
8. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
9. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
10. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
A total of 72 subgoals...
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(0 \<le> c * (l div c) * x + l div c * Inum (x # bs) e) = (l div c * 0 \<le> l div c * (c * x + Inum (x # bs) e))
goal (72 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
6. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
7. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
8. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
9. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
10. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
A total of 72 subgoals...
[PROOF STEP]
have "\<dots> \<longleftrightarrow> c * x + Inum (x # bs) e \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (l div c * 0 \<le> l div c * (c * x + Inum (x # bs) e)) = (0 \<le> c * x + Inum (x # bs) e)
[PROOF STEP]
using ldcp zero_le_mult_iff [where a="l div c" and b="c*x + Inum (x # bs) e"]
[PROOF STATE]
proof (prove)
using this:
0 < l div c
(0 \<le> l div c * (c * x + Inum (x # bs) e)) = (0 \<le> l div c \<and> 0 \<le> c * x + Inum (x # bs) e \<or> l div c \<le> 0 \<and> c * x + Inum (x # bs) e \<le> 0)
goal (1 subgoal):
1. (l div c * 0 \<le> l div c * (c * x + Inum (x # bs) e)) = (0 \<le> c * x + Inum (x # bs) e)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(l div c * 0 \<le> l div c * (c * x + Inum (x # bs) e)) = (0 \<le> c * x + Inum (x # bs) e)
goal (72 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>c e. \<lbrakk>iszlfm (Ge (CN 0 c e)); d_\<beta> (Ge (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
6. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
7. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
8. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
9. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
10. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
A total of 72 subgoals...
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(0 \<le> l * x + l div c * Inum (x # bs) e) = (0 \<le> c * x + Inum (x # bs) e)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(0 \<le> l * x + l div c * Inum (x # bs) e) = (0 \<le> c * x + Inum (x # bs) e)
goal (1 subgoal):
1. iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
[PROOF STEP]
using be numbound0_I[OF be,where b="l*x" and b'="x" and bs="bs"]
[PROOF STATE]
proof (prove)
using this:
(0 \<le> l * x + l div c * Inum (x # bs) e) = (0 \<le> c * x + Inum (x # bs) e)
numbound0 e
Inum (l * x # bs) e = Inum (x # bs) e
goal (1 subgoal):
1. iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
iszlfm (a_\<beta> (Ge (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Ge (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Ge (CN 0 c e)) l) = Ifm bbs (x # bs) (Ge (CN 0 c e))
goal (71 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
6. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
7. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
8. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
9. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
10. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
A total of 71 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (71 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
6. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
7. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
8. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
9. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
10. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
A total of 71 subgoals...
[PROOF STEP]
case (3 c e)
[PROOF STATE]
proof (state)
this:
iszlfm (Eq (CN 0 c e))
d_\<beta> (Eq (CN 0 c e)) l
goal (71 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
6. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
7. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
8. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
9. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
10. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
A total of 71 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
iszlfm (Eq (CN 0 c e))
d_\<beta> (Eq (CN 0 c e)) l
[PROOF STEP]
have cp: "c > 0" and be: "numbound0 e" and d': "c dvd l"
[PROOF STATE]
proof (prove)
using this:
iszlfm (Eq (CN 0 c e))
d_\<beta> (Eq (CN 0 c e)) l
goal (1 subgoal):
1. 0 < c &&& numbound0 e &&& c dvd l
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
0 < c
numbound0 e
c dvd l
goal (71 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
6. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
7. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
8. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
9. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
10. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
A total of 71 subgoals...
[PROOF STEP]
from lp cp
[PROOF STATE]
proof (chain)
picking this:
0 < l
0 < c
[PROOF STEP]
have clel: "c \<le> l"
[PROOF STATE]
proof (prove)
using this:
0 < l
0 < c
goal (1 subgoal):
1. c \<le> l
[PROOF STEP]
by (simp add: zdvd_imp_le [OF d' lp])
[PROOF STATE]
proof (state)
this:
c \<le> l
goal (71 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
6. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
7. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
8. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
9. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
10. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
A total of 71 subgoals...
[PROOF STEP]
from cp
[PROOF STATE]
proof (chain)
picking this:
0 < c
[PROOF STEP]
have cnz: "c \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
0 < c
goal (1 subgoal):
1. c \<noteq> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c \<noteq> 0
goal (71 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
6. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
7. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
8. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
9. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
10. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
A total of 71 subgoals...
[PROOF STEP]
have "c div c \<le> l div c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. c div c \<le> l div c
[PROOF STEP]
by (simp add: zdiv_mono1[OF clel cp])
[PROOF STATE]
proof (state)
this:
c div c \<le> l div c
goal (71 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
6. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
7. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
8. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
9. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
10. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
A total of 71 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c div c \<le> l div c
[PROOF STEP]
have ldcp:"0 < l div c"
[PROOF STATE]
proof (prove)
using this:
c div c \<le> l div c
goal (1 subgoal):
1. 0 < l div c
[PROOF STEP]
by (simp add: div_self[OF cnz])
[PROOF STATE]
proof (state)
this:
0 < l div c
goal (71 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
6. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
7. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
8. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
9. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
10. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
A total of 71 subgoals...
[PROOF STEP]
have "c * (l div c) = c * (l div c) + l mod c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. c * (l div c) = c * (l div c) + l mod c
[PROOF STEP]
using d' dvd_eq_mod_eq_0[of "c" "l"]
[PROOF STATE]
proof (prove)
using this:
c dvd l
(c dvd l) = (l mod c = 0)
goal (1 subgoal):
1. c * (l div c) = c * (l div c) + l mod c
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c * (l div c) = c * (l div c) + l mod c
goal (71 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
6. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
7. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
8. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
9. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
10. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
A total of 71 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c * (l div c) = c * (l div c) + l mod c
[PROOF STEP]
have cl:"c * (l div c) =l"
[PROOF STATE]
proof (prove)
using this:
c * (l div c) = c * (l div c) + l mod c
goal (1 subgoal):
1. c * (l div c) = l
[PROOF STEP]
using mult_div_mod_eq [where a="l" and b="c"]
[PROOF STATE]
proof (prove)
using this:
c * (l div c) = c * (l div c) + l mod c
c * (l div c) + l mod c = l
goal (1 subgoal):
1. c * (l div c) = l
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c * (l div c) = l
goal (71 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
6. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
7. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
8. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
9. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
10. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
A total of 71 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c * (l div c) = l
[PROOF STEP]
have "l * x + (l div c) * Inum (x # bs) e = 0 \<longleftrightarrow>
(c * (l div c)) * x + (l div c) * Inum (x # bs) e = 0"
[PROOF STATE]
proof (prove)
using this:
c * (l div c) = l
goal (1 subgoal):
1. (l * x + l div c * Inum (x # bs) e = 0) = (c * (l div c) * x + l div c * Inum (x # bs) e = 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(l * x + l div c * Inum (x # bs) e = 0) = (c * (l div c) * x + l div c * Inum (x # bs) e = 0)
goal (71 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
6. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
7. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
8. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
9. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
10. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
A total of 71 subgoals...
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(l * x + l div c * Inum (x # bs) e = 0) = (c * (l div c) * x + l div c * Inum (x # bs) e = 0)
goal (71 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
6. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
7. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
8. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
9. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
10. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
A total of 71 subgoals...
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (l div c) * (c * x + Inum (x # bs) e) = ((l div c)) * 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (c * (l div c) * x + l div c * Inum (x # bs) e = 0) = (l div c * (c * x + Inum (x # bs) e) = l div c * 0)
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
(c * (l div c) * x + l div c * Inum (x # bs) e = 0) = (l div c * (c * x + Inum (x # bs) e) = l div c * 0)
goal (71 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
6. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
7. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
8. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
9. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
10. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
A total of 71 subgoals...
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(c * (l div c) * x + l div c * Inum (x # bs) e = 0) = (l div c * (c * x + Inum (x # bs) e) = l div c * 0)
goal (71 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
6. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
7. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
8. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
9. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
10. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
A total of 71 subgoals...
[PROOF STEP]
have "\<dots> \<longleftrightarrow> c * x + Inum (x # bs) e = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (l div c * (c * x + Inum (x # bs) e) = l div c * 0) = (c * x + Inum (x # bs) e = 0)
[PROOF STEP]
using mult_eq_0_iff [where a="(l div c)" and b="c * x + Inum (x # bs) e"] ldcp
[PROOF STATE]
proof (prove)
using this:
(l div c * (c * x + Inum (x # bs) e) = 0) = (l div c = 0 \<or> c * x + Inum (x # bs) e = 0)
0 < l div c
goal (1 subgoal):
1. (l div c * (c * x + Inum (x # bs) e) = l div c * 0) = (c * x + Inum (x # bs) e = 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(l div c * (c * x + Inum (x # bs) e) = l div c * 0) = (c * x + Inum (x # bs) e = 0)
goal (71 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (Eq (CN 0 c e)); d_\<beta> (Eq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
4. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
5. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
6. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
7. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
8. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
9. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
10. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
A total of 71 subgoals...
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(l * x + l div c * Inum (x # bs) e = 0) = (c * x + Inum (x # bs) e = 0)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(l * x + l div c * Inum (x # bs) e = 0) = (c * x + Inum (x # bs) e = 0)
goal (1 subgoal):
1. iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
[PROOF STEP]
using numbound0_I[OF be,where b="(l * x)" and b'="x" and bs="bs"] be
[PROOF STATE]
proof (prove)
using this:
(l * x + l div c * Inum (x # bs) e = 0) = (c * x + Inum (x # bs) e = 0)
Inum (l * x # bs) e = Inum (x # bs) e
numbound0 e
goal (1 subgoal):
1. iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
iszlfm (a_\<beta> (Eq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Eq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Eq (CN 0 c e)) l) = Ifm bbs (x # bs) (Eq (CN 0 c e))
goal (70 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
5. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
6. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
7. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
8. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
9. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
10. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
A total of 70 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (70 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
5. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
6. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
7. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
8. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
9. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
10. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
A total of 70 subgoals...
[PROOF STEP]
case (4 c e)
[PROOF STATE]
proof (state)
this:
iszlfm (NEq (CN 0 c e))
d_\<beta> (NEq (CN 0 c e)) l
goal (70 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
5. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
6. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
7. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
8. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
9. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
10. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
A total of 70 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
iszlfm (NEq (CN 0 c e))
d_\<beta> (NEq (CN 0 c e)) l
[PROOF STEP]
have cp: "c > 0" and be: "numbound0 e" and d': "c dvd l"
[PROOF STATE]
proof (prove)
using this:
iszlfm (NEq (CN 0 c e))
d_\<beta> (NEq (CN 0 c e)) l
goal (1 subgoal):
1. 0 < c &&& numbound0 e &&& c dvd l
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
0 < c
numbound0 e
c dvd l
goal (70 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
5. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
6. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
7. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
8. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
9. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
10. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
A total of 70 subgoals...
[PROOF STEP]
from lp cp
[PROOF STATE]
proof (chain)
picking this:
0 < l
0 < c
[PROOF STEP]
have clel: "c \<le> l"
[PROOF STATE]
proof (prove)
using this:
0 < l
0 < c
goal (1 subgoal):
1. c \<le> l
[PROOF STEP]
by (simp add: zdvd_imp_le [OF d' lp])
[PROOF STATE]
proof (state)
this:
c \<le> l
goal (70 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
5. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
6. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
7. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
8. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
9. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
10. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
A total of 70 subgoals...
[PROOF STEP]
from cp
[PROOF STATE]
proof (chain)
picking this:
0 < c
[PROOF STEP]
have cnz: "c \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
0 < c
goal (1 subgoal):
1. c \<noteq> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c \<noteq> 0
goal (70 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
5. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
6. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
7. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
8. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
9. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
10. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
A total of 70 subgoals...
[PROOF STEP]
have "c div c \<le> l div c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. c div c \<le> l div c
[PROOF STEP]
by (simp add: zdiv_mono1[OF clel cp])
[PROOF STATE]
proof (state)
this:
c div c \<le> l div c
goal (70 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
5. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
6. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
7. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
8. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
9. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
10. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
A total of 70 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c div c \<le> l div c
[PROOF STEP]
have ldcp:"0 < l div c"
[PROOF STATE]
proof (prove)
using this:
c div c \<le> l div c
goal (1 subgoal):
1. 0 < l div c
[PROOF STEP]
by (simp add: div_self[OF cnz])
[PROOF STATE]
proof (state)
this:
0 < l div c
goal (70 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
5. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
6. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
7. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
8. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
9. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
10. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
A total of 70 subgoals...
[PROOF STEP]
have "c * (l div c) = c * (l div c) + l mod c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. c * (l div c) = c * (l div c) + l mod c
[PROOF STEP]
using d' dvd_eq_mod_eq_0[of "c" "l"]
[PROOF STATE]
proof (prove)
using this:
c dvd l
(c dvd l) = (l mod c = 0)
goal (1 subgoal):
1. c * (l div c) = c * (l div c) + l mod c
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c * (l div c) = c * (l div c) + l mod c
goal (70 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
5. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
6. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
7. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
8. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
9. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
10. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
A total of 70 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c * (l div c) = c * (l div c) + l mod c
[PROOF STEP]
have cl: "c * (l div c) = l"
[PROOF STATE]
proof (prove)
using this:
c * (l div c) = c * (l div c) + l mod c
goal (1 subgoal):
1. c * (l div c) = l
[PROOF STEP]
using mult_div_mod_eq [where a="l" and b="c"]
[PROOF STATE]
proof (prove)
using this:
c * (l div c) = c * (l div c) + l mod c
c * (l div c) + l mod c = l
goal (1 subgoal):
1. c * (l div c) = l
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c * (l div c) = l
goal (70 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
5. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
6. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
7. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
8. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
9. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
10. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
A total of 70 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c * (l div c) = l
[PROOF STEP]
have "l * x + (l div c) * Inum (x # bs) e \<noteq> 0 \<longleftrightarrow>
(c * (l div c)) * x + (l div c) * Inum (x # bs) e \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
c * (l div c) = l
goal (1 subgoal):
1. (l * x + l div c * Inum (x # bs) e \<noteq> 0) = (c * (l div c) * x + l div c * Inum (x # bs) e \<noteq> 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(l * x + l div c * Inum (x # bs) e \<noteq> 0) = (c * (l div c) * x + l div c * Inum (x # bs) e \<noteq> 0)
goal (70 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
5. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
6. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
7. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
8. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
9. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
10. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
A total of 70 subgoals...
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(l * x + l div c * Inum (x # bs) e \<noteq> 0) = (c * (l div c) * x + l div c * Inum (x # bs) e \<noteq> 0)
goal (70 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
5. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
6. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
7. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
8. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
9. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
10. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
A total of 70 subgoals...
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (l div c) * (c * x + Inum (x # bs) e) \<noteq> (l div c) * 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (c * (l div c) * x + l div c * Inum (x # bs) e \<noteq> 0) = (l div c * (c * x + Inum (x # bs) e) \<noteq> l div c * 0)
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
(c * (l div c) * x + l div c * Inum (x # bs) e \<noteq> 0) = (l div c * (c * x + Inum (x # bs) e) \<noteq> l div c * 0)
goal (70 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
5. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
6. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
7. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
8. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
9. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
10. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
A total of 70 subgoals...
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(c * (l div c) * x + l div c * Inum (x # bs) e \<noteq> 0) = (l div c * (c * x + Inum (x # bs) e) \<noteq> l div c * 0)
goal (70 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
5. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
6. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
7. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
8. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
9. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
10. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
A total of 70 subgoals...
[PROOF STEP]
have "\<dots> \<longleftrightarrow> c * x + Inum (x # bs) e \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (l div c * (c * x + Inum (x # bs) e) \<noteq> l div c * 0) = (c * x + Inum (x # bs) e \<noteq> 0)
[PROOF STEP]
using zero_le_mult_iff [where a="(l div c)" and b="c * x + Inum (x # bs) e"] ldcp
[PROOF STATE]
proof (prove)
using this:
(0 \<le> l div c * (c * x + Inum (x # bs) e)) = (0 \<le> l div c \<and> 0 \<le> c * x + Inum (x # bs) e \<or> l div c \<le> 0 \<and> c * x + Inum (x # bs) e \<le> 0)
0 < l div c
goal (1 subgoal):
1. (l div c * (c * x + Inum (x # bs) e) \<noteq> l div c * 0) = (c * x + Inum (x # bs) e \<noteq> 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(l div c * (c * x + Inum (x # bs) e) \<noteq> l div c * 0) = (c * x + Inum (x # bs) e \<noteq> 0)
goal (70 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>c e. \<lbrakk>iszlfm (NEq (CN 0 c e)); d_\<beta> (NEq (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
5. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
6. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
7. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
8. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
9. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
10. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
A total of 70 subgoals...
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(l * x + l div c * Inum (x # bs) e \<noteq> 0) = (c * x + Inum (x # bs) e \<noteq> 0)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(l * x + l div c * Inum (x # bs) e \<noteq> 0) = (c * x + Inum (x # bs) e \<noteq> 0)
goal (1 subgoal):
1. iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
[PROOF STEP]
using numbound0_I[OF be,where b="(l * x)" and b'="x" and bs="bs"] be
[PROOF STATE]
proof (prove)
using this:
(l * x + l div c * Inum (x # bs) e \<noteq> 0) = (c * x + Inum (x # bs) e \<noteq> 0)
Inum (l * x # bs) e = Inum (x # bs) e
numbound0 e
goal (1 subgoal):
1. iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
iszlfm (a_\<beta> (NEq (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NEq (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NEq (CN 0 c e)) l) = Ifm bbs (x # bs) (NEq (CN 0 c e))
goal (69 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
5. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
6. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
7. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
8. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
9. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
10. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
A total of 69 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (69 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
5. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
6. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
7. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
8. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
9. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
10. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
A total of 69 subgoals...
[PROOF STEP]
case (9 j c e)
[PROOF STATE]
proof (state)
this:
iszlfm (Dvd j (CN 0 c e))
d_\<beta> (Dvd j (CN 0 c e)) l
goal (69 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
5. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
6. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
7. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
8. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
9. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
10. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
A total of 69 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
iszlfm (Dvd j (CN 0 c e))
d_\<beta> (Dvd j (CN 0 c e)) l
[PROOF STEP]
have cp: "c > 0" and be: "numbound0 e" and jp: "j > 0" and d': "c dvd l"
[PROOF STATE]
proof (prove)
using this:
iszlfm (Dvd j (CN 0 c e))
d_\<beta> (Dvd j (CN 0 c e)) l
goal (1 subgoal):
1. (0 < c &&& numbound0 e) &&& 0 < j &&& c dvd l
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
0 < c
numbound0 e
0 < j
c dvd l
goal (69 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
5. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
6. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
7. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
8. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
9. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
10. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
A total of 69 subgoals...
[PROOF STEP]
from lp cp
[PROOF STATE]
proof (chain)
picking this:
0 < l
0 < c
[PROOF STEP]
have clel: "c \<le> l"
[PROOF STATE]
proof (prove)
using this:
0 < l
0 < c
goal (1 subgoal):
1. c \<le> l
[PROOF STEP]
by (simp add: zdvd_imp_le [OF d' lp])
[PROOF STATE]
proof (state)
this:
c \<le> l
goal (69 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
5. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
6. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
7. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
8. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
9. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
10. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
A total of 69 subgoals...
[PROOF STEP]
from cp
[PROOF STATE]
proof (chain)
picking this:
0 < c
[PROOF STEP]
have cnz: "c \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
0 < c
goal (1 subgoal):
1. c \<noteq> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c \<noteq> 0
goal (69 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
5. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
6. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
7. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
8. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
9. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
10. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
A total of 69 subgoals...
[PROOF STEP]
have "c div c\<le> l div c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. c div c \<le> l div c
[PROOF STEP]
by (simp add: zdiv_mono1[OF clel cp])
[PROOF STATE]
proof (state)
this:
c div c \<le> l div c
goal (69 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
5. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
6. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
7. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
8. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
9. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
10. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
A total of 69 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c div c \<le> l div c
[PROOF STEP]
have ldcp:"0 < l div c"
[PROOF STATE]
proof (prove)
using this:
c div c \<le> l div c
goal (1 subgoal):
1. 0 < l div c
[PROOF STEP]
by (simp add: div_self[OF cnz])
[PROOF STATE]
proof (state)
this:
0 < l div c
goal (69 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
5. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
6. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
7. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
8. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
9. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
10. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
A total of 69 subgoals...
[PROOF STEP]
have "c * (l div c) = c * (l div c) + l mod c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. c * (l div c) = c * (l div c) + l mod c
[PROOF STEP]
using d' dvd_eq_mod_eq_0[of "c" "l"]
[PROOF STATE]
proof (prove)
using this:
c dvd l
(c dvd l) = (l mod c = 0)
goal (1 subgoal):
1. c * (l div c) = c * (l div c) + l mod c
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c * (l div c) = c * (l div c) + l mod c
goal (69 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
5. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
6. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
7. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
8. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
9. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
10. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
A total of 69 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c * (l div c) = c * (l div c) + l mod c
[PROOF STEP]
have cl: "c * (l div c) = l"
[PROOF STATE]
proof (prove)
using this:
c * (l div c) = c * (l div c) + l mod c
goal (1 subgoal):
1. c * (l div c) = l
[PROOF STEP]
using mult_div_mod_eq [where a="l" and b="c"]
[PROOF STATE]
proof (prove)
using this:
c * (l div c) = c * (l div c) + l mod c
c * (l div c) + l mod c = l
goal (1 subgoal):
1. c * (l div c) = l
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c * (l div c) = l
goal (69 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
5. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
6. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
7. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
8. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
9. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
10. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
A total of 69 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c * (l div c) = l
[PROOF STEP]
have "(\<exists>k::int. l * x + (l div c) * Inum (x # bs) e = ((l div c) * j) * k) \<longleftrightarrow>
(\<exists>k::int. (c * (l div c)) * x + (l div c) * Inum (x # bs) e = ((l div c) * j) * k)"
[PROOF STATE]
proof (prove)
using this:
c * (l div c) = l
goal (1 subgoal):
1. (\<exists>k. l * x + l div c * Inum (x # bs) e = l div c * j * k) = (\<exists>k. c * (l div c) * x + l div c * Inum (x # bs) e = l div c * j * k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<exists>k. l * x + l div c * Inum (x # bs) e = l div c * j * k) = (\<exists>k. c * (l div c) * x + l div c * Inum (x # bs) e = l div c * j * k)
goal (69 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
5. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
6. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
7. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
8. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
9. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
10. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
A total of 69 subgoals...
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<exists>k. l * x + l div c * Inum (x # bs) e = l div c * j * k) = (\<exists>k. c * (l div c) * x + l div c * Inum (x # bs) e = l div c * j * k)
goal (69 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
5. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
6. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
7. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
8. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
9. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
10. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
A total of 69 subgoals...
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (\<exists>k::int. (l div c) * (c * x + Inum (x # bs) e - j * k) = (l div c) * 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<exists>k. c * (l div c) * x + l div c * Inum (x # bs) e = l div c * j * k) = (\<exists>k. l div c * (c * x + Inum (x # bs) e - j * k) = l div c * 0)
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
(\<exists>k. c * (l div c) * x + l div c * Inum (x # bs) e = l div c * j * k) = (\<exists>k. l div c * (c * x + Inum (x # bs) e - j * k) = l div c * 0)
goal (69 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
5. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
6. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
7. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
8. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
9. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
10. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
A total of 69 subgoals...
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<exists>k. c * (l div c) * x + l div c * Inum (x # bs) e = l div c * j * k) = (\<exists>k. l div c * (c * x + Inum (x # bs) e - j * k) = l div c * 0)
goal (69 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
5. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
6. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
7. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
8. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
9. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
10. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
A total of 69 subgoals...
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (\<exists>k::int. c * x + Inum (x # bs) e - j * k = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<exists>k. l div c * (c * x + Inum (x # bs) e - j * k) = l div c * 0) = (\<exists>k. c * x + Inum (x # bs) e - j * k = 0)
[PROOF STEP]
using zero_le_mult_iff [where a="(l div c)" and b="c * x + Inum (x # bs) e - j * k" for k] ldcp
[PROOF STATE]
proof (prove)
using this:
(0 \<le> l div c * (c * x + Inum (x # bs) e - j * ?k2)) = (0 \<le> l div c \<and> 0 \<le> c * x + Inum (x # bs) e - j * ?k2 \<or> l div c \<le> 0 \<and> c * x + Inum (x # bs) e - j * ?k2 \<le> 0)
0 < l div c
goal (1 subgoal):
1. (\<exists>k. l div c * (c * x + Inum (x # bs) e - j * k) = l div c * 0) = (\<exists>k. c * x + Inum (x # bs) e - j * k = 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<exists>k. l div c * (c * x + Inum (x # bs) e - j * k) = l div c * 0) = (\<exists>k. c * x + Inum (x # bs) e - j * k = 0)
goal (69 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
5. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
6. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
7. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
8. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
9. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
10. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
A total of 69 subgoals...
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<exists>k. l div c * (c * x + Inum (x # bs) e - j * k) = l div c * 0) = (\<exists>k. c * x + Inum (x # bs) e - j * k = 0)
goal (69 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
5. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
6. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
7. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
8. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
9. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
10. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
A total of 69 subgoals...
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (\<exists>k::int. c * x + Inum (x # bs) e = j * k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<exists>k. c * x + Inum (x # bs) e - j * k = 0) = (\<exists>k. c * x + Inum (x # bs) e = j * k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<exists>k. c * x + Inum (x # bs) e - j * k = 0) = (\<exists>k. c * x + Inum (x # bs) e = j * k)
goal (69 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (Dvd i (CN 0 c e)); d_\<beta> (Dvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Dvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd i (CN 0 c e))
4. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
5. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
6. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
7. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
8. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
9. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
10. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
A total of 69 subgoals...
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<exists>k. l * x + l div c * Inum (x # bs) e = l div c * j * k) = (\<exists>k. c * x + Inum (x # bs) e = j * k)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(\<exists>k. l * x + l div c * Inum (x # bs) e = l div c * j * k) = (\<exists>k. c * x + Inum (x # bs) e = j * k)
goal (1 subgoal):
1. iszlfm (a_\<beta> (Dvd j (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd j (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd j (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd j (CN 0 c e))
[PROOF STEP]
using numbound0_I[OF be,where b="(l * x)" and b'="x" and bs="bs"]
be mult_strict_mono[OF ldcp jp ldcp ]
[PROOF STATE]
proof (prove)
using this:
(\<exists>k. l * x + l div c * Inum (x # bs) e = l div c * j * k) = (\<exists>k. c * x + Inum (x # bs) e = j * k)
Inum (l * x # bs) e = Inum (x # bs) e
numbound0 e
0 \<le> 0 \<Longrightarrow> 0 * 0 < l div c * j
goal (1 subgoal):
1. iszlfm (a_\<beta> (Dvd j (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd j (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd j (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd j (CN 0 c e))
[PROOF STEP]
by (simp add: dvd_def)
[PROOF STATE]
proof (state)
this:
iszlfm (a_\<beta> (Dvd j (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (Dvd j (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Dvd j (CN 0 c e)) l) = Ifm bbs (x # bs) (Dvd j (CN 0 c e))
goal (68 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
4. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
5. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
6. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
7. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
8. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
9. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
10. \<And>va vb. \<lbrakk>iszlfm (Lt (Add va vb)); d_\<beta> (Lt (Add va vb)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Add va vb)) l) \<and> d_\<beta> (a_\<beta> (Lt (Add va vb)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Add va vb)) l) = Ifm bbs (x # bs) (Lt (Add va vb))
A total of 68 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (68 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
4. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
5. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
6. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
7. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
8. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
9. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
10. \<And>va vb. \<lbrakk>iszlfm (Lt (Add va vb)); d_\<beta> (Lt (Add va vb)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Add va vb)) l) \<and> d_\<beta> (a_\<beta> (Lt (Add va vb)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Add va vb)) l) = Ifm bbs (x # bs) (Lt (Add va vb))
A total of 68 subgoals...
[PROOF STEP]
case (10 j c e)
[PROOF STATE]
proof (state)
this:
iszlfm (NDvd j (CN 0 c e))
d_\<beta> (NDvd j (CN 0 c e)) l
goal (68 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
4. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
5. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
6. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
7. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
8. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
9. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
10. \<And>va vb. \<lbrakk>iszlfm (Lt (Add va vb)); d_\<beta> (Lt (Add va vb)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Add va vb)) l) \<and> d_\<beta> (a_\<beta> (Lt (Add va vb)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Add va vb)) l) = Ifm bbs (x # bs) (Lt (Add va vb))
A total of 68 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
iszlfm (NDvd j (CN 0 c e))
d_\<beta> (NDvd j (CN 0 c e)) l
[PROOF STEP]
have cp: "c > 0" and be: "numbound0 e" and jp: "j > 0" and d': "c dvd l"
[PROOF STATE]
proof (prove)
using this:
iszlfm (NDvd j (CN 0 c e))
d_\<beta> (NDvd j (CN 0 c e)) l
goal (1 subgoal):
1. (0 < c &&& numbound0 e) &&& 0 < j &&& c dvd l
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
0 < c
numbound0 e
0 < j
c dvd l
goal (68 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
4. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
5. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
6. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
7. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
8. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
9. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
10. \<And>va vb. \<lbrakk>iszlfm (Lt (Add va vb)); d_\<beta> (Lt (Add va vb)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Add va vb)) l) \<and> d_\<beta> (a_\<beta> (Lt (Add va vb)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Add va vb)) l) = Ifm bbs (x # bs) (Lt (Add va vb))
A total of 68 subgoals...
[PROOF STEP]
from lp cp
[PROOF STATE]
proof (chain)
picking this:
0 < l
0 < c
[PROOF STEP]
have clel: "c \<le> l"
[PROOF STATE]
proof (prove)
using this:
0 < l
0 < c
goal (1 subgoal):
1. c \<le> l
[PROOF STEP]
by (simp add: zdvd_imp_le [OF d' lp])
[PROOF STATE]
proof (state)
this:
c \<le> l
goal (68 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
4. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
5. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
6. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
7. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
8. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
9. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
10. \<And>va vb. \<lbrakk>iszlfm (Lt (Add va vb)); d_\<beta> (Lt (Add va vb)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Add va vb)) l) \<and> d_\<beta> (a_\<beta> (Lt (Add va vb)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Add va vb)) l) = Ifm bbs (x # bs) (Lt (Add va vb))
A total of 68 subgoals...
[PROOF STEP]
from cp
[PROOF STATE]
proof (chain)
picking this:
0 < c
[PROOF STEP]
have cnz: "c \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
0 < c
goal (1 subgoal):
1. c \<noteq> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c \<noteq> 0
goal (68 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
4. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
5. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
6. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
7. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
8. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
9. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
10. \<And>va vb. \<lbrakk>iszlfm (Lt (Add va vb)); d_\<beta> (Lt (Add va vb)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Add va vb)) l) \<and> d_\<beta> (a_\<beta> (Lt (Add va vb)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Add va vb)) l) = Ifm bbs (x # bs) (Lt (Add va vb))
A total of 68 subgoals...
[PROOF STEP]
have "c div c \<le> l div c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. c div c \<le> l div c
[PROOF STEP]
by (simp add: zdiv_mono1[OF clel cp])
[PROOF STATE]
proof (state)
this:
c div c \<le> l div c
goal (68 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
4. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
5. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
6. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
7. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
8. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
9. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
10. \<And>va vb. \<lbrakk>iszlfm (Lt (Add va vb)); d_\<beta> (Lt (Add va vb)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Add va vb)) l) \<and> d_\<beta> (a_\<beta> (Lt (Add va vb)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Add va vb)) l) = Ifm bbs (x # bs) (Lt (Add va vb))
A total of 68 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c div c \<le> l div c
[PROOF STEP]
have ldcp: "0 < l div c"
[PROOF STATE]
proof (prove)
using this:
c div c \<le> l div c
goal (1 subgoal):
1. 0 < l div c
[PROOF STEP]
by (simp add: div_self[OF cnz])
[PROOF STATE]
proof (state)
this:
0 < l div c
goal (68 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
4. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
5. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
6. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
7. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
8. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
9. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
10. \<And>va vb. \<lbrakk>iszlfm (Lt (Add va vb)); d_\<beta> (Lt (Add va vb)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Add va vb)) l) \<and> d_\<beta> (a_\<beta> (Lt (Add va vb)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Add va vb)) l) = Ifm bbs (x # bs) (Lt (Add va vb))
A total of 68 subgoals...
[PROOF STEP]
have "c * (l div c) = c* (l div c) + l mod c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. c * (l div c) = c * (l div c) + l mod c
[PROOF STEP]
using d' dvd_eq_mod_eq_0[of "c" "l"]
[PROOF STATE]
proof (prove)
using this:
c dvd l
(c dvd l) = (l mod c = 0)
goal (1 subgoal):
1. c * (l div c) = c * (l div c) + l mod c
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c * (l div c) = c * (l div c) + l mod c
goal (68 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
4. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
5. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
6. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
7. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
8. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
9. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
10. \<And>va vb. \<lbrakk>iszlfm (Lt (Add va vb)); d_\<beta> (Lt (Add va vb)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Add va vb)) l) \<and> d_\<beta> (a_\<beta> (Lt (Add va vb)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Add va vb)) l) = Ifm bbs (x # bs) (Lt (Add va vb))
A total of 68 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c * (l div c) = c * (l div c) + l mod c
[PROOF STEP]
have cl:"c * (l div c) =l"
[PROOF STATE]
proof (prove)
using this:
c * (l div c) = c * (l div c) + l mod c
goal (1 subgoal):
1. c * (l div c) = l
[PROOF STEP]
using mult_div_mod_eq [where a="l" and b="c"]
[PROOF STATE]
proof (prove)
using this:
c * (l div c) = c * (l div c) + l mod c
c * (l div c) + l mod c = l
goal (1 subgoal):
1. c * (l div c) = l
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c * (l div c) = l
goal (68 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
4. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
5. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
6. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
7. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
8. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
9. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
10. \<And>va vb. \<lbrakk>iszlfm (Lt (Add va vb)); d_\<beta> (Lt (Add va vb)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Add va vb)) l) \<and> d_\<beta> (a_\<beta> (Lt (Add va vb)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Add va vb)) l) = Ifm bbs (x # bs) (Lt (Add va vb))
A total of 68 subgoals...
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c * (l div c) = l
[PROOF STEP]
have "(\<exists>k::int. l * x + (l div c) * Inum (x # bs) e = ((l div c) * j) * k) \<longleftrightarrow>
(\<exists>k::int. (c * (l div c)) * x + (l div c) * Inum (x # bs) e = ((l div c) * j) * k)"
[PROOF STATE]
proof (prove)
using this:
c * (l div c) = l
goal (1 subgoal):
1. (\<exists>k. l * x + l div c * Inum (x # bs) e = l div c * j * k) = (\<exists>k. c * (l div c) * x + l div c * Inum (x # bs) e = l div c * j * k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<exists>k. l * x + l div c * Inum (x # bs) e = l div c * j * k) = (\<exists>k. c * (l div c) * x + l div c * Inum (x # bs) e = l div c * j * k)
goal (68 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
4. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
5. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
6. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
7. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
8. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
9. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
10. \<And>va vb. \<lbrakk>iszlfm (Lt (Add va vb)); d_\<beta> (Lt (Add va vb)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Add va vb)) l) \<and> d_\<beta> (a_\<beta> (Lt (Add va vb)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Add va vb)) l) = Ifm bbs (x # bs) (Lt (Add va vb))
A total of 68 subgoals...
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<exists>k. l * x + l div c * Inum (x # bs) e = l div c * j * k) = (\<exists>k. c * (l div c) * x + l div c * Inum (x # bs) e = l div c * j * k)
goal (68 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
4. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
5. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
6. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
7. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
8. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
9. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
10. \<And>va vb. \<lbrakk>iszlfm (Lt (Add va vb)); d_\<beta> (Lt (Add va vb)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Add va vb)) l) \<and> d_\<beta> (a_\<beta> (Lt (Add va vb)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Add va vb)) l) = Ifm bbs (x # bs) (Lt (Add va vb))
A total of 68 subgoals...
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (\<exists>k::int. (l div c) * (c * x + Inum (x # bs) e - j * k) = (l div c) * 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<exists>k. c * (l div c) * x + l div c * Inum (x # bs) e = l div c * j * k) = (\<exists>k. l div c * (c * x + Inum (x # bs) e - j * k) = l div c * 0)
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
(\<exists>k. c * (l div c) * x + l div c * Inum (x # bs) e = l div c * j * k) = (\<exists>k. l div c * (c * x + Inum (x # bs) e - j * k) = l div c * 0)
goal (68 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
4. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
5. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
6. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
7. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
8. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
9. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
10. \<And>va vb. \<lbrakk>iszlfm (Lt (Add va vb)); d_\<beta> (Lt (Add va vb)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Add va vb)) l) \<and> d_\<beta> (a_\<beta> (Lt (Add va vb)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Add va vb)) l) = Ifm bbs (x # bs) (Lt (Add va vb))
A total of 68 subgoals...
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<exists>k. c * (l div c) * x + l div c * Inum (x # bs) e = l div c * j * k) = (\<exists>k. l div c * (c * x + Inum (x # bs) e - j * k) = l div c * 0)
goal (68 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
4. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
5. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
6. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
7. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
8. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
9. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
10. \<And>va vb. \<lbrakk>iszlfm (Lt (Add va vb)); d_\<beta> (Lt (Add va vb)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Add va vb)) l) \<and> d_\<beta> (a_\<beta> (Lt (Add va vb)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Add va vb)) l) = Ifm bbs (x # bs) (Lt (Add va vb))
A total of 68 subgoals...
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (\<exists>k::int. c * x + Inum (x # bs) e - j * k = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<exists>k. l div c * (c * x + Inum (x # bs) e - j * k) = l div c * 0) = (\<exists>k. c * x + Inum (x # bs) e - j * k = 0)
[PROOF STEP]
using zero_le_mult_iff [where a="(l div c)" and b="c * x + Inum (x # bs) e - j * k" for k] ldcp
[PROOF STATE]
proof (prove)
using this:
(0 \<le> l div c * (c * x + Inum (x # bs) e - j * ?k2)) = (0 \<le> l div c \<and> 0 \<le> c * x + Inum (x # bs) e - j * ?k2 \<or> l div c \<le> 0 \<and> c * x + Inum (x # bs) e - j * ?k2 \<le> 0)
0 < l div c
goal (1 subgoal):
1. (\<exists>k. l div c * (c * x + Inum (x # bs) e - j * k) = l div c * 0) = (\<exists>k. c * x + Inum (x # bs) e - j * k = 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<exists>k. l div c * (c * x + Inum (x # bs) e - j * k) = l div c * 0) = (\<exists>k. c * x + Inum (x # bs) e - j * k = 0)
goal (68 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
4. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
5. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
6. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
7. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
8. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
9. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
10. \<And>va vb. \<lbrakk>iszlfm (Lt (Add va vb)); d_\<beta> (Lt (Add va vb)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Add va vb)) l) \<and> d_\<beta> (a_\<beta> (Lt (Add va vb)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Add va vb)) l) = Ifm bbs (x # bs) (Lt (Add va vb))
A total of 68 subgoals...
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<exists>k. l div c * (c * x + Inum (x # bs) e - j * k) = l div c * 0) = (\<exists>k. c * x + Inum (x # bs) e - j * k = 0)
goal (68 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
4. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
5. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
6. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
7. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
8. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
9. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
10. \<And>va vb. \<lbrakk>iszlfm (Lt (Add va vb)); d_\<beta> (Lt (Add va vb)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Add va vb)) l) \<and> d_\<beta> (a_\<beta> (Lt (Add va vb)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Add va vb)) l) = Ifm bbs (x # bs) (Lt (Add va vb))
A total of 68 subgoals...
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (\<exists>k::int. c * x + Inum (x # bs) e = j * k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<exists>k. c * x + Inum (x # bs) e - j * k = 0) = (\<exists>k. c * x + Inum (x # bs) e = j * k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<exists>k. c * x + Inum (x # bs) e - j * k = 0) = (\<exists>k. c * x + Inum (x # bs) e = j * k)
goal (68 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<And>i c e. \<lbrakk>iszlfm (NDvd i (CN 0 c e)); d_\<beta> (NDvd i (CN 0 c e)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (NDvd i (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd i (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd i (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd i (CN 0 c e))
4. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
5. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
6. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
7. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
8. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
9. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
10. \<And>va vb. \<lbrakk>iszlfm (Lt (Add va vb)); d_\<beta> (Lt (Add va vb)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Add va vb)) l) \<and> d_\<beta> (a_\<beta> (Lt (Add va vb)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Add va vb)) l) = Ifm bbs (x # bs) (Lt (Add va vb))
A total of 68 subgoals...
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<exists>k. l * x + l div c * Inum (x # bs) e = l div c * j * k) = (\<exists>k. c * x + Inum (x # bs) e = j * k)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(\<exists>k. l * x + l div c * Inum (x # bs) e = l div c * j * k) = (\<exists>k. c * x + Inum (x # bs) e = j * k)
goal (1 subgoal):
1. iszlfm (a_\<beta> (NDvd j (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd j (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd j (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd j (CN 0 c e))
[PROOF STEP]
using numbound0_I[OF be,where b="(l * x)" and b'="x" and bs="bs"] be
mult_strict_mono[OF ldcp jp ldcp ]
[PROOF STATE]
proof (prove)
using this:
(\<exists>k. l * x + l div c * Inum (x # bs) e = l div c * j * k) = (\<exists>k. c * x + Inum (x # bs) e = j * k)
Inum (l * x # bs) e = Inum (x # bs) e
numbound0 e
0 \<le> 0 \<Longrightarrow> 0 * 0 < l div c * j
goal (1 subgoal):
1. iszlfm (a_\<beta> (NDvd j (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd j (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd j (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd j (CN 0 c e))
[PROOF STEP]
by (simp add: dvd_def)
[PROOF STATE]
proof (state)
this:
iszlfm (a_\<beta> (NDvd j (CN 0 c e)) l) \<and> d_\<beta> (a_\<beta> (NDvd j (CN 0 c e)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (NDvd j (CN 0 c e)) l) = Ifm bbs (x # bs) (NDvd j (CN 0 c e))
goal (67 subgoals):
1. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (And p q); d_\<beta> (And p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (And p q) l) \<and> d_\<beta> (a_\<beta> (And p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (And p q) l) = Ifm bbs (x # bs) (And p q)
2. \<And>p q. \<lbrakk>\<lbrakk>iszlfm p; d_\<beta> p l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> p l) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> p l) = Ifm bbs (x # bs) p; \<lbrakk>iszlfm q; d_\<beta> q l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> q l) \<and> d_\<beta> (a_\<beta> q l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> q l) = Ifm bbs (x # bs) q; iszlfm (Or p q); d_\<beta> (Or p q) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Or p q) l) \<and> d_\<beta> (a_\<beta> (Or p q) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Or p q) l) = Ifm bbs (x # bs) (Or p q)
3. \<lbrakk>iszlfm T; d_\<beta> T l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> T l) \<and> d_\<beta> (a_\<beta> T l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> T l) = Ifm bbs (x # bs) T
4. \<lbrakk>iszlfm F; d_\<beta> F l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> F l) \<and> d_\<beta> (a_\<beta> F l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> F l) = Ifm bbs (x # bs) F
5. \<And>va. \<lbrakk>iszlfm (Lt (C va)); d_\<beta> (Lt (C va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (C va)) l) \<and> d_\<beta> (a_\<beta> (Lt (C va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (C va)) l) = Ifm bbs (x # bs) (Lt (C va))
6. \<And>va. \<lbrakk>iszlfm (Lt (Bound va)); d_\<beta> (Lt (Bound va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Bound va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Bound va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Bound va)) l) = Ifm bbs (x # bs) (Lt (Bound va))
7. \<And>vd vb vc. \<lbrakk>iszlfm (Lt (CN (Suc vd) vb vc)); d_\<beta> (Lt (CN (Suc vd) vb vc)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) \<and> d_\<beta> (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (CN (Suc vd) vb vc)) l) = Ifm bbs (x # bs) (Lt (CN (Suc vd) vb vc))
8. \<And>va. \<lbrakk>iszlfm (Lt (Neg va)); d_\<beta> (Lt (Neg va)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Neg va)) l) \<and> d_\<beta> (a_\<beta> (Lt (Neg va)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Neg va)) l) = Ifm bbs (x # bs) (Lt (Neg va))
9. \<And>va vb. \<lbrakk>iszlfm (Lt (Add va vb)); d_\<beta> (Lt (Add va vb)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Add va vb)) l) \<and> d_\<beta> (a_\<beta> (Lt (Add va vb)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Add va vb)) l) = Ifm bbs (x # bs) (Lt (Add va vb))
10. \<And>va vb. \<lbrakk>iszlfm (Lt (Sub va vb)); d_\<beta> (Lt (Sub va vb)) l\<rbrakk> \<Longrightarrow> iszlfm (a_\<beta> (Lt (Sub va vb)) l) \<and> d_\<beta> (a_\<beta> (Lt (Sub va vb)) l) 1 \<and> Ifm bbs (l * x # bs) (a_\<beta> (Lt (Sub va vb)) l) = Ifm bbs (x # bs) (Lt (Sub va vb))
A total of 67 subgoals...
[PROOF STEP]
qed (auto simp add: gr0_conv_Suc numbound0_I[where bs="bs" and b="(l * x)" and b'="x"])
|
module Pow
namespace Preloaded
%access public export
%default total
||| Divides a natural number by 2 and returns
||| the quotient and the remainder as a boolean value:
||| True = remainder is 1, False = remainder is 0.
divMod2 : Nat -> (Nat, Bool)
divMod2 Z = (Z, False)
divMod2 (S Z) = (Z, True)
divMod2 (S (S n)) = case divMod2 n of (q, r) => (S q, r)
-- The first argument (k) helps Idris to prove
-- that the function terminates.
powSqrAux : Nat -> Nat -> Nat -> Nat
powSqrAux Z _ _ = 1
powSqrAux _ _ Z = 1
powSqrAux (S k) b e =
case divMod2 e of
(e', False) => powSqrAux k (b * b) e'
(e', True) => b * powSqrAux k (b * b) e'
powSqr : Nat -> Nat -> Nat
powSqr b e = powSqrAux e b e
%access export
%default total
-- The following lemma is useful
divMod2Lemma : (n : Nat) -> n = 2 * fst (divMod2 n) + if snd (divMod2 n) then 1 else 0
divMod2Lemma Z = Refl
divMod2Lemma (S Z) = Refl
divMod2Lemma (S (S k)) with (divMod2 k) proof eq
| (q, _) = rewrite divMod2Lemma k in
rewrite sym eq in
rewrite sym $ plusSuccRightSucc q (q + 0) in
Refl
powEq : (b, e : Nat) -> powSqr b e = power b e
powEq b e with (divMod2 e) proof eq
| (e', True) = ?proof_rhs_1
| (e', False) = rewrite divMod2Lemma e in
rewrite sym eq in
rewrite plusZeroRightNeutral e' in
rewrite plusZeroRightNeutral $ e'+e' in
?proof_rhs_2
|
###############################################################
### Creates a new .Renviron file to the specified directory ###
###############################################################
wd <- "WORKING_DIRECTORY"
key <- "KEY"
token <- "TOKEN"
#NOTES:
#(I) Enviromental variables in the new .Renviron are always loaded in the startup if the WORKING_DIRECTORY
# is the one specified in .Rprofile
#(II) If not, then they can be loaded in Rstudio after running this file and choosing: Session -> New Session
setwd(wd)
user_renviron = path.expand(file.path(getwd(), ".Renviron"))
if(!file.exists(user_renviron)) {
file.create(user_renviron)
} # check to see if the file already exists
writeLines(c(paste0("OP_API_KEY=", key), paste0("OP_API_TOKEN=", token)), con = ".Renviron")
|
Require Import Coq.ZArith.BinIntDef.
Require Import Coq.NArith.BinNatDef.
Require Import Coq.PArith.BinPosDef.
Require Coq.ZArith.Znumtheory Coq.Numbers.BinNums.
Require Crypto.Arithmetic.ModularArithmeticPre.
Delimit Scope positive_scope with positive.
Bind Scope positive_scope with BinPos.positive.
Infix "+" := BinPos.Pos.add : positive_scope.
Infix "*" := BinPos.Pos.mul : positive_scope.
Infix "-" := BinPos.Pos.sub : positive_scope.
Infix "^" := BinPos.Pos.pow : positive_scope.
Delimit Scope N_scope with N.
Bind Scope N_scope with BinNums.N.
Infix "+" := BinNat.N.add : N_scope.
Infix "*" := BinNat.N.mul : N_scope.
Infix "-" := BinNat.N.sub : N_scope.
Infix "/" := BinNat.N.div : N_scope.
Infix "^" := BinNat.N.pow : N_scope.
Delimit Scope Z_scope with Z.
Bind Scope Z_scope with BinInt.Z.
Infix "+" := BinInt.Z.add : Z_scope.
Infix "*" := BinInt.Z.mul : Z_scope.
Infix "-" := BinInt.Z.sub : Z_scope.
Infix "/" := BinInt.Z.div : Z_scope.
Infix "^" := BinInt.Z.pow : Z_scope.
Infix "mod" := BinInt.Z.modulo (at level 40, no associativity) : Z_scope.
Local Open Scope Z_scope.
Global Coercion BinInt.Z.pos : BinPos.positive >-> BinInt.Z.
Global Coercion BinInt.Z.of_N : BinNums.N >-> BinInt.Z.
Global Set Printing Coercions.
Module F.
Definition F (m : BinPos.positive) := { z : BinInt.Z | z = z mod m }.
Local Obligation Tactic := cbv beta; auto using ModularArithmeticPre.Z_mod_mod.
Program Definition of_Z m (a:BinNums.Z) : F m := a mod m.
Definition to_Z {m} (a:F m) : BinNums.Z := proj1_sig a.
Section FieldOperations.
Context {m : BinPos.positive}.
Definition zero : F m := of_Z m 0.
Definition one : F m := of_Z m 1.
Definition add (a b:F m) : F m := of_Z m (to_Z a + to_Z b).
Definition mul (a b:F m) : F m := of_Z m (to_Z a * to_Z b).
Definition opp (a : F m) : F m := of_Z m (0 - to_Z a).
Definition sub (a b:F m) : F m := add a (opp b).
Definition inv_with_spec : { inv : F m -> F m
| inv zero = zero
/\ ( Znumtheory.prime m ->
forall a, a <> zero -> mul (inv a) a = one )
} := ModularArithmeticPre.inv_impl.
Definition inv : F m -> F m := Eval hnf in proj1_sig inv_with_spec.
Definition div (a b:F m) : F m := mul a (inv b).
Definition pow_with_spec : { pow : F m -> BinNums.N -> F m
| forall a, pow a 0%N = one
/\ forall x, pow a (1 + x)%N = mul a (pow a x)
} := ModularArithmeticPre.pow_impl.
Definition pow : F m -> BinNums.N -> F m := Eval hnf in proj1_sig pow_with_spec.
End FieldOperations.
Definition of_nat m (n:nat) := F.of_Z m (BinInt.Z.of_nat n).
Definition to_nat {m} (x:F m) := BinInt.Z.to_nat (F.to_Z x).
Notation nat_mod := of_nat (only parsing).
Definition of_N m n := F.of_Z m (BinInt.Z.of_N n).
Definition to_N {m} (x:F m) := BinInt.Z.to_N (F.to_Z x).
Notation N_mod := of_N (only parsing).
Notation Z_mod := of_Z (only parsing).
End F.
Notation F := F.F.
Declare Scope F_scope.
Delimit Scope F_scope with F.
Bind Scope F_scope with F.F.
Infix "+" := F.add : F_scope.
Infix "*" := F.mul : F_scope.
Infix "-" := F.sub : F_scope.
Infix "/" := F.div : F_scope.
Infix "^" := F.pow : F_scope.
Notation "0" := F.zero : F_scope.
Notation "1" := F.one : F_scope.
|
module Control.Monad.Ideal
%access public
%default total
data Ideal : (Type -> Type) -> Type -> Type where
P : {f : Type -> Type} -> a -> Ideal f a
I : {f : Type -> Type} -> (f a) -> Ideal f a
class Functor f => Mu' (f : Type -> Type) where
mu' : f (Ideal f a) -> f a
instance Mu' f => Functor (Ideal f) where
map g (P a) = P $ g a
map g (I fa) = I $ map g fa
instance Mu' f => Applicative (Ideal f) where
pure a = P a
(P g) <$> x = map g x
(I fg) <$> (P a) = I $ mu' $ map (\k => P $ k a) fg
(I fg) <$> (I fa) = I $ mu' $ map (\k => I $ map k fa) fg
instance Mu' f => Monad (Ideal f) where
(P a) >>= k = k a
(I fa) >>= k = I $ mu' $ map k fa
|
Some tips for dealing with a New York condo board of managers | Nadel & Ciarlo, P.C.
On behalf of Nadel & Ciarlo, P.C. posted in Residential Real Estate on Tuesday, November 25, 2014.
Condominiums have become a popular form of residential real estate ownership for many New Yorkers. In a condominium, residents have separate ownership of their individual units, and an undivided interest, shared with other residents, in the common areas such as hallways, elevators and building lobbies.
Condominiums are governed by a board of managers. The board members are typically residents of the building and are often serving without pay. Ideally, they should try to resolve any issues amicably and maintain good relations with residents. Unfortunately, with some boards this is not always the case.
A condo board is legally obligated to follow the internal rules and procedures found in the condominium declaration, the by-laws and the house rules. Like the board of directors of a corporation, they are obligated to act with prudent judgment in making business decisions. Boards are also bound to comply with the New York Condominium Act.
If you believe your board is not acting in compliance with internal rules or the law, your first step should be to speak to a board member, explain the problem and request that it be remedied or corrected. If that does not resolve the issue, you should write a letter to the board and keep a copy for your records. Your request will carry much more weight if you have the support of other residents. Condominium boards are elected by the residents and will be more responsive to an organized group.
Litigation should be a last resort in a dispute with a condo board. Litigation can be expensive and you should keep in mind that you have to live in the same building with the people you are suing. Nonetheless, in serious cases where the board is not complying with the law or the internal rules of the building, it may be necessary to go to court.
|
State Before: α : Type u
inst✝ : CanonicallyOrderedMonoid α
a b c d : α
⊢ a ≤ b * a State After: α : Type u
inst✝ : CanonicallyOrderedMonoid α
a b c d : α
⊢ a ≤ a * b Tactic: rw [mul_comm] State Before: α : Type u
inst✝ : CanonicallyOrderedMonoid α
a b c d : α
⊢ a ≤ a * b State After: no goals Tactic: exact le_self_mul
|
// generate by pypp <https://github.com/mugwort-rc/pypp>
// original source code: SPK_Ring.h
#include <Extensions/Zones/SPK_Ring.h>
#include <Core/SPK_Particle.h>
#include <boost/python.hpp>
class RingWrapper :
public SPK::Ring,
public boost::python::wrapper<SPK::Ring>
{
public:
using SPK::Ring::Ring;
std::string getClassName() const {
if (auto getClassName = this->get_override("getClassName")) {
return getClassName();
}
else {
return Ring::getClassName();
}
}
void generatePosition(SPK::Particle & particle, bool full) const {
if (auto generatePosition = this->get_override("generatePosition")) {
generatePosition(particle, full);
}
else {
Ring::generatePosition(particle, full);
}
}
bool contains(const SPK::Vector3D & v) const {
if (auto contains = this->get_override("contains")) {
return contains(v);
}
else {
return Ring::contains(v);
}
}
bool intersects(const SPK::Vector3D & v0, const SPK::Vector3D & v1, SPK::Vector3D * intersection, SPK::Vector3D * normal) const {
if (auto intersects = this->get_override("intersects")) {
return intersects(v0, v1, intersection, normal);
}
else {
return Ring::intersects(v0, v1, intersection, normal);
}
}
void moveAtBorder(SPK::Vector3D & v, bool inside) const {
if (auto moveAtBorder = this->get_override("moveAtBorder")) {
moveAtBorder(v, inside);
}
else {
Ring::moveAtBorder(v, inside);
}
}
SPK::Vector3D computeNormal(const SPK::Vector3D & point) const {
if (auto computeNormal = this->get_override("computeNormal")) {
return computeNormal(point);
}
else {
return Ring::computeNormal(point);
}
}
void innerUpdateTransform() {
if (auto innerUpdateTransform = this->get_override("_innerUpdateTransform")) {
innerUpdateTransform();
}
else {
Ring::innerUpdateTransform();
}
}
};
BOOST_PYTHON_FUNCTION_OVERLOADS(create_overload, SPK::Ring::create, 0, 4)
void init_SPK_Ring_h() {
boost::python::class_<RingWrapper, boost::python::bases<SPK::Zone>, std::shared_ptr<SPK::Ring>>("Ring",
boost::python::init<boost::python::optional<const SPK::Vector3D &, const SPK::Vector3D &, float, float>>(
":brief: Constructor of ring\n"
":param position: the position of the ring\n"
":param normal: the normal of the plane on which lies the ring\n"
":param minRadius: the minimum radius of the ring\n"
":param maxRadius: the maximum radius of the ring\n"))
.def("getClassName", &SPK::Ring::getClassName)
.def("create", &SPK::Ring::create, create_overload(
":brief: Creates and registers a new Ring\n"
":param position: the position of the ring\n"
":param normal: the normal of the plane on which lies the ring\n"
":param minRadius: the minimum radius of the ring\n"
":param maxRadius: the maximum radius of the ring\n"
":return: a new registered ring\n")
[boost::python::return_value_policy<boost::python::reference_existing_object>()])
.def("setNormal", &SPK::Ring::setNormal,
":brief: Sets the normal of the plane on which lies this ring\n"
"\n"
"Note that the normal is normalized internally\n"
"\n"
":param normal: the normal of the plane on which lies the ring\n")
.def("setRadius", &SPK::Ring::setRadius,
":brief: Sets the min and max radius of this ring\n"
"\n"
"A radius cannot be negative.\n"
"Note that negative radius are inverted internally\n"
"\n"
":param minRadius: the minimum radius of this ring\n"
":param maxRadius: the maximum radius of this ring\n")
.def("getNormal", &SPK::Ring::getNormal,
":brief: Gets the normal of this ring\n"
":return: the normal of this ring\n",
boost::python::return_value_policy<boost::python::copy_const_reference>())
.def("getTransformedNormal", &SPK::Ring::getTransformedNormal,
":brief: Gets the transformed normal of this ring\n"
":return: the transformed normal of this ring\n",
boost::python::return_value_policy<boost::python::copy_const_reference>())
.def("getMinRadius", &SPK::Ring::getMinRadius,
":brief: Gets the minimum radius of this ring\n"
":return: the minimum radius of this ring\n")
.def("getMaxRadius", &SPK::Ring::getMaxRadius,
":brief: Gets the maximum radius of this ring\n"
":return: the maximum radius of this ring\n")
.def("generatePosition", &SPK::Ring::generatePosition)
.def("contains", &SPK::Ring::contains)
.def("intersects", &SPK::Ring::intersects)
.def("moveAtBorder", &SPK::Ring::moveAtBorder)
.def("computeNormal", &SPK::Ring::computeNormal)
.staticmethod("create")
;
}
|
#!/usr/bin/Rscript
args <- commandArgs(trailingOnly=T)
## for rice:
#sed '1,3d' ref_genome/masked/IRGSP-1.0_genome.fasta.out | awk -v OFS="\t" '{print $5, $6-1, $7, $11}' > ref_genome/IRGSP-1.0_repeat_aggressive.bed
#sed -i 's/?//g' IRGSP-1.0_repeat_aggressive.bed
#cut -f4 ref_genome/IRGSP-1.0_repeat_aggressive.bed | sort | uniq > ref_genome/aggresive_repeats_list.txt
##--- input preparation
##for file in positive.all.4000.max20NN.maxoverlap1kb.bed negative.all.4000.max20NN.maxoverlap1kb.bed
##do
## bedtools intersect -wo -a $file -b ref_genome/*repeats_aggressive.bed > $file.repeats.overlap.out
#args = c("positive.all.4000.max20NN.maxoverlap1kb.bed.repeats.overlap.out",
# "positive.all.4000.max20NN.maxoverlap1kb.bed",
# "positive.all.4000.max20NN.maxoverlap1kb.bed.repeat.content.txt",
# "ref_genome/aggresive_repeats_list.txt")
file = args[1] # 8-column bedtools intersect output file
ori_file = args[2] # 3-column bed file
outfile = args[3]
namesfile = args[4] # list of features i.e. list of repeats
df = read.table(file, header=F, sep="\t", stringsAsFactors=F)
colnames(df) = c("region_chrom", "region_start", "region_end",
"chrom", "start", "end", "type", "overlap")
ori = read.table(ori_file, header=F, sep="\t", stringsAsFactors=F)
colnames(ori) = c("chrom", "start", "end")
names = read.table(namesfile, header=F, sep="\t", stringsAsFactors=F)
names = names[,1]
for (i in 1:nrow(df)){
df[i,'id'] = paste(df[i,'region_chrom'], ":", df[i, 'region_start'], "-", df[i, 'region_end'], sep="")
}
for (i in 1:nrow(ori)){
ori[i,'id'] = paste(ori[i,'chrom'], ":", ori[i, 'start'], "-", ori[i, 'end'], sep="")
}
idlist = ori$id ### take the id list from original file
dfout = data.frame(matrix(NA, ncol = 3, nrow = length(idlist)))
dfout[,'id'] = idlist
count = 0
for (i in 1:nrow(dfout)){
#for (i in 1:2){
id = dfout[i,'id']
dfI = df[which(id == df[,'id']),]
#// this section counts the overlapping hits whose repeat class is different
# for example if LTR and LTR/Copia overlaps for the same hit..
if (nrow(dfI) > 1){
dfI = dfI[order(dfI$start),]
for (k in 1:(nrow(dfI)-1)){
if (dfI[k, 'end'] >= dfI[k+1,'start'] ){
if (dfI[k,'type'] != dfI[k+1, 'type']){
count = count + 1
# print("overlap found")
# print(dfI[k,])
# print(dfI[k+1,])
}
}
}
}
#//
# types = unique(dfI[,'type'])
types = names
for (type in types){
dfIt = dfI[which(dfI[,'type'] == type),]
if (nrow(dfIt) == 0) {
dfout[i, type] = 0
next
}
if (nrow(dfIt) == 1){
ratio = dfIt[1,'overlap'] / (dfIt[1,'region_end'] - dfIt[1,'region_start'])
dfout[i, type] = ratio
} else { ## MERGING
# sort by start
# check if it is overlaps to the next one
# if not overlaps, save the first ones 'overlap' value to somewhere
# if it is overlaps, save the distance from first row start to second row start
s = dfIt[order(dfIt$start),] # sorted
for (k in 1:nrow(s)){ # merging
n = nrow(s)
j=1
I = c()
while (j < n){
if( s[j, 'end'] >= s[j+1, 'start']){ # overlapping
s[j, 'start'] = min(s[j, 'start' ], s[j+1, 'start'])
s[j, "end"] = max(s[j, 'end'], s[j+1, 'end'])
I = c(I, j)
j = j+ 2
} else {
I =c(I, j)
j = j+1
}
if (j == n) I = c(I, j)
}
if (length(I) != 0) s = s[I,] # update s
}
# find the new overlap of each region in s
for (j in 1:nrow(s)){
st = s[j, 'start'] -1
end = s[j, 'end'] -1
rst = s[j, 'region_start']
rend = s[j, 'region_end']
l = sort(c(st, end, rst, rend))
s[j, 'overlap'] = l[3] - l[2]
}
dfout[i, type] = sum(s[,'overlap']) / (dfIt[1,'region_end'] - dfIt[1,'region_start'])
}
}
}
dfout = dfout[,4:ncol(dfout)]
## for 0 count
for (j in 1:ncol(dfout)) { print(colnames(dfout)[j]);
print(length(which(dfout[,j] == 0)) / nrow(dfout) * 100) }
write.table(dfout, file=outfile,
col.names=T, row.names=F, sep="\t", quote=F, )
|
module Replica.Core
import public Replica.Core.Types
import public Replica.Core.Parse
|
lemma divide_poly: assumes g: "g \<noteq> 0" shows "(f * g) div g = (f :: 'a poly)"
|
import numpy as np
import fn_tensors as fnt
from copy import deepcopy
def test(graph, bdims, perm):
return fnt.logcontract(deepcopy(graph), bdims, perm)
def fitness(graph, bdims, population):
reverse_fit = [test(graph, bdims, population[i]) for i in range(len(population))]
maximum = np.max(reverse_fit)
minimum = np.min(reverse_fit)
spread = maximum-minimum
if spread == 0:
spread += 1
return np.exp(1-(reverse_fit-minimum)/spread)-0.99, minimum
def mutate(num_bonds,population):
for i in range(len(population)):
swap = np.random.randint(0,num_bonds,size=2)
population[i][swap[0]], population[i][swap[1]] = population[i][swap[1]], population[i][swap[0]]
return population
def step(graph, bdims, population, mut_rate=.2):
fit, minrew = fitness(graph, bdims, population)
probabilities = fit/fit.sum()
best_genotype = population[np.argmax(probabilities)].reshape(1,-1)
which_genes = np.random.choice(len(population), size=len(population)-1, replace=True, p=probabilities).astype(int)
population = np.array([population[i] for i in which_genes])
num_mutate = int(mut_rate*len(population))
population = np.concatenate((mutate(len(bdims),population[0:num_mutate]), population[num_mutate:], best_genotype), axis=0)
return population, minrew, best_genotype[0]
|
Reines was accepted into the Massachusetts Institute of Technology , but chose instead to attend Stevens Institute of Technology in Hoboken , New Jersey , where he earned his Bachelor of Science ( B.S. ) degree in mechanical engineering in 1939 , and his Master of Science ( M.S. ) degree in mathematical physics in 1941 , writing a thesis on " A Critical Review of Optical Diffraction Theory " . He married Sylvia Samuels on August 30 , 1940 . They had two children , Robert and Alisa . He then entered New York University , where he earned his Doctor of Philosophy ( Ph.D. ) in 1944 . He studied cosmic rays there under Serge A. Korff , but wrote his thesis under the supervision of Richard D. Present on " Nuclear fission and the liquid drop model of the nucleus " . Publication of the thesis was delayed until after the end of World War II ; it appeared in Physical Review in 1946 .
|
If $m > 0$, then $m x + c < y$ if and only if $x < \frac{1}{m} y - \frac{c}{m}$.
|
Set Automatic Coercions Import.
Require Import c_util.
Require Import util.
Require Import geometry.
Require Import CRreal.
Require Import CRexp.
Require Import CRln.
Require Import Morphisms.
Set Implicit Arguments.
Open Local Scope CR_scope.
(* We require CR because we use it for Time.
Todo: Take an arbitrary (C)Ring/(C)Field for Time, so that
the classical development does not need a separate concrete module. *)
Let Time := CRasCSetoid.
Let Duration := NonNegCR.
Record Flow (X: CSetoid): Type :=
{ flow_morphism:> morpher (@st_eq X ==> @st_eq Time ==> @st_eq X)%signature
; flow_zero: forall x, flow_morphism x 0 [=] x
; flow_additive: forall x t t',
flow_morphism x (t + t') [=] flow_morphism (flow_morphism x t) t'
}.
Definition mono (f: Flow CRasCSetoid): Type :=
((forall x, strongly_increasing (f x)) + (forall x, strongly_decreasing (f x)))%type.
Definition range_flow_inv_spec (f: Flow CRasCSetoid)
(i: OpenRange -> OpenRange -> OpenRange): Prop :=
forall a p, in_orange a p -> forall b t, in_orange b (f p t) -> in_orange (i a b) t.
Hint Unfold range_flow_inv_spec.
Obligation Tactic := idtac.
Program Definition product_flow (X Y: CSetoid) (fx: Flow X) (fy: Flow Y):
Flow (ProdCSetoid X Y) :=
Build_Flow _ (fun xy t => (fx (fst xy) t, fy (snd xy) t)) _ _.
Next Obligation.
intros X Y fx fy [s s0] [s1 s2] [A B] x y H0.
split; [rewrite A | rewrite B]; rewrite H0; reflexivity.
Qed.
Next Obligation. destruct x. split; apply flow_zero. Qed.
Next Obligation. destruct x. split; apply flow_additive. Qed.
Module constant.
Section contents.
Program Definition flow: Flow CRasCSetoid := Build_Flow _ (fun x _ => x) _ _.
Next Obligation. exact (fun _ _ H _ _ _ => H). Qed.
Next Obligation. reflexivity. Qed.
Next Obligation. reflexivity. Qed.
Let eps: Qpos := (1#100)%Qpos. (* todo: turn into parameter *)
Definition neg_range: OpenRange.
exists (Some (-'1%Q), Some (-'1%Q)).
unfold uncurry. simpl. auto.
Defined.
Definition inv (a b: OpenRange): OpenRange :=
if overestimate_oranges_overlap eps a b: bool then unbounded_range else neg_range.
Lemma inv_correct: range_flow_inv_spec flow inv.
Proof with auto.
unfold range_flow_inv_spec, inv.
intros.
destruct_call overestimate_oranges_overlap.
destruct x...
elimtype False.
apply n, oranges_share_point with p...
Qed.
End contents.
End constant.
Module scale.
Section contents.
Variables (s: CR) (sp: CRpos s) (f: Flow CRasCSetoid).
Program Definition flow: Flow CRasCSetoid :=
Build_Flow _ (fun x t => f x (s * t)) _ _.
Next Obligation. intros a a' e b b' e'. rewrite e, e'. reflexivity. Qed.
Next Obligation.
intros. unfold morpher_to_func, proj1_sig.
rewrite CRmult_0_r. apply flow_zero.
Qed.
Next Obligation.
intros.
unfold morpher_to_func at 1 3 5, proj1_sig.
rewrite
<- flow_additive,
(Rmul_comm CR_ring_theory),
(Rmul_comm CR_ring_theory s t),
(Rmul_comm CR_ring_theory s t'),
(Rdistr_l CR_ring_theory).
reflexivity.
Qed.
Lemma inc: (forall x, strongly_increasing (f x)) ->
forall x, strongly_increasing (flow x).
Proof.
repeat intro. unfold flow. simpl.
apply X, CRmult_lt_pos_r; assumption.
Qed.
Variable old_inv: OpenRange -> OpenRange -> OpenRange.
Hypothesis old_inv_correct: range_flow_inv_spec f old_inv.
Lemma CRpos_apart_0 x: CRpos x -> x >< 0.
right. apply CRpos_lt_0_rev. assumption.
Defined.
Definition sinv: CR := CRinvT s (CRpos_apart_0 sp).
Lemma sinv_nonneg: 0 <= sinv.
Proof.
apply CRlt_le.
apply CRpos_lt_0_rev.
unfold sinv.
apply CRinvT_pos.
assumption.
Qed.
Definition inv (a b: OpenRange): OpenRange := scale_orange sinv_nonneg (old_inv a b).
Lemma inv_correct: range_flow_inv_spec flow inv.
Proof with auto.
unfold range_flow_inv_spec in *.
intros.
unfold inv.
simpl in H0.
set (old_inv_correct H _ H0).
clearbody i.
assert (fst (` (scale_orange sinv_nonneg (old_inv a b))) [=] fst (` (scale_orange sinv_nonneg (old_inv a b)))) by reflexivity.
assert (snd (` (scale_orange sinv_nonneg (old_inv a b))) [=] snd (` (scale_orange sinv_nonneg (old_inv a b)))) by reflexivity.
assert (sinv * (s * t) == t).
rewrite (Rmul_assoc CR_ring_theory).
unfold sinv.
rewrite (Rmul_comm CR_ring_theory (CRinvT s _)).
unfold CRinv.
rewrite (CRinvT_mult).
apply (Rmul_1_l CR_ring_theory).
rewrite <- H3. (* todo: this takes ridiculously long *)
apply in_scale_orange...
Qed.
End contents.
End scale.
Hint Resolve scale.inc scale.inv_correct.
Module positive_linear.
Section contents.
Program Definition f: Flow CRasCSetoid :=
Build_Flow _ (ucFun2 CRplus_uc) CRadd_0_r (Radd_assoc CR_ring_theory).
Definition inv (x x': CR): Time := x' - x.
Lemma inv_correct x x': f x (inv x x') == x'.
Proof. intros. symmetry. apply t11. Qed.
Lemma increasing: forall x : CRasCSetoid, strongly_increasing (f x).
Proof. repeat intro. apply t1_rev. assumption. Qed.
Definition mono: mono f := inl increasing.
End contents.
End positive_linear.
Hint Immediate positive_linear.increasing.
Module negative_linear.
Section contents.
Let B x t t': x - (t + t') == x - t - t'.
intros.
rewrite (@Ropp_add _ _ _ _ _ _ _ _ t3 CR_ring_eq_ext CR_ring_theory ).
apply (Radd_assoc CR_ring_theory).
Qed.
Program Definition f: Flow CRasCSetoid :=
Build_Flow _ (fun x t => x - t) CRminus_zero B.
Definition inv (x x': CR): Time := x - x'.
Lemma inv_correct x x': f x (inv x x') == x'.
intros.
unfold f, inv.
simpl morpher_to_func.
rewrite <- diff_opp.
symmetry.
apply t11.
Qed.
Lemma decreasing: forall x : CRasCSetoid, strongly_decreasing (f x).
repeat intro. simpl.
apply t1_rev, CRlt_opp_compat.
assumption.
Qed.
Definition mono: mono f := inr decreasing.
End contents.
End negative_linear.
Require Import vector_setoid.
Require Import VecEq.
Lemma Vforall2n_aux_inv (A B: Type) (R: A -> B -> Prop) n (v: vector A n) m (w: vector B m):
Vforall2n_aux R v w -> forall i (p: lt i n) (q: lt i m), R (Vnth v p) (Vnth w q).
Admitted. (*
Proof.
induction v; destruct w; simpl; intros; intuition.
elimtype False.
apply (lt_n_O _ p).
destruct i; auto.
Qed. *)
Definition eq_vec_inv (T: Type) (R: relation T) n (x y: vector T n) (e: eq_vec R x y)
i (p: (i < n)%nat): R (Vnth x p) (Vnth y p)
:= Vforall2n_aux_inv _ _ _ e p p.
(* Todo: Move the above two elsewhere. *)
Section vector_flow.
Variable n : nat.
Variable X : CSetoid.
Variable vec_f : vector (Flow X) n.
Let f (vec_x : vecCSetoid X n) (t : Time) : vecCSetoid X n :=
let flow_dim i ip :=
let f := Vnth vec_f ip in
let x := Vnth vec_x ip in
f x t
in
Vbuild flow_dim.
Program Definition vector_flow : Flow (vecCSetoid X n) :=
Build_Flow _ f _ _.
Next Obligation. (* well-defined-ness *)
do 6 intro.
apply Veq_vec_nth. intros.
unfold f.
repeat rewrite Vbuild_nth.
unfold morpher_to_func.
rewrite (eq_vec_inv (@st_eq _) x y H).
rewrite H0.
reflexivity.
Qed.
Next Obligation. (* flow_zero *)
apply Veq_vec_nth. intros. unfold f.
repeat rewrite Vbuild_nth. apply flow_zero.
Qed.
Next Obligation. (* flow_additive *)
apply Veq_vec_nth. intros. unfold f.
repeat rewrite Vbuild_nth. apply flow_additive.
Qed.
End vector_flow.
|
import for_mathlib.is_locally_constant
import locally_constant.analysis
/-!
# Extending a locally constant map to larger profinite sets
In this file, we prove that, given a topological embedding `e : X → Y` from a non-empty
compact topological space to a profinite set (ie. compact Hausdorff totally disconnected space),
every locally constant map `f` from `X` to any type `Z` "extends" to a locally constant map
from `Y` to `Z`, ie. there exists `g : Y → Z` locally constant such that `f = g ∘ e`.
e
X ↪-→ Y
| /
f | / h
↓ ↙
Z
Notes:
* this wouldn't work if `X` and `Z` were empty and `Y` weren't. The minimal assumption
would be assuming `Z` isn't empty, I'll refactor this soon.
* Everything is stated assuming only `X` is compact but the existence of `f` ensures `X` is
profinite, we're just saving type-class search (and nothing in the construction or proofs
directly use `X` is profinite).
The main definition is `embedding.extend {e : X → Y} (he : embedding e) (f : X → Z) : Y → Z`
It assumes `X` is compact (and non-empty) and assumes `Y` is profinite but doesn't
assume `f` is locally constant, it is simply defined as a constant map if `f` isn't.
The announced properties of this extension are `embedding.extend_extends` and
`embedding.is_locally_constant_extend`.
-/
variables {X : Type*} [topological_space X]
noncomputable theory
open set
variables [compact_space X]
{Y : Type*} [topological_space Y] [t2_space Y] [compact_space Y] [totally_disconnected_space Y]
lemma embedding.preimage_clopen {f : X → Y} (hf : embedding f) {U : set X} (hU : is_clopen U) :
∃ V : set Y, is_clopen V ∧ U = f ⁻¹' V :=
begin
cases hU with hU hU',
have hfU : is_compact (f '' U),
from hU'.is_compact.image hf.continuous,
obtain ⟨W, W_op, hfW⟩ : ∃ W : set Y, is_open W ∧ f ⁻¹' W = U,
{ rw hf.to_inducing.induced at hU,
exact is_open_induced_iff.mp hU },
obtain ⟨ι, Z : ι → set Y, hWZ : W = ⋃ i, Z i, hZ : ∀ i, is_clopen $ Z i⟩ :=
is_topological_basis_clopen.open_eq_Union W_op,
have : f '' U ⊆ ⋃ i, Z i,
{ rw [image_subset_iff, ← hWZ, hfW] },
obtain ⟨I, hI⟩ : ∃ I : finset ι, f '' U ⊆ ⋃ i ∈ I, Z i,
from hfU.elim_finite_subcover _ (λ i, (hZ i).1) this,
refine ⟨⋃ i ∈ I, Z i, _, _⟩,
{ apply is_clopen_bUnion, apply finset.finite_to_set,
tauto },
{ apply subset.antisymm,
exact image_subset_iff.mp hI,
have : (⋃ i ∈ I, Z i) ⊆ ⋃ i, Z i,
from Union₂_subset_Union _ _,
rw [← hfW, hWZ],
mono },
end
lemma embedding.ex_discrete_quotient [nonempty X] {f : X → Y} (hf : embedding f) (S : discrete_quotient X) :
∃ (S' : discrete_quotient Y) (g : S ≃ S'), S'.proj ∘ f = g ∘ S.proj :=
begin
classical,
inhabit X,
haveI : fintype S := discrete_quotient.fintype S,
have : ∀ s : S, ∃ V : set Y, is_clopen V ∧ S.proj ⁻¹' {s} = f ⁻¹' V,
from λ s, hf.preimage_clopen (S.fiber_clopen {s}),
choose V hV using this,
rw forall_and_distrib at hV,
cases hV with V_cl hV,
let s₀ := S.proj default,
let W : S → set Y := λ s, (V s) \ (⋃ s' (h : s' ≠ s), V s'),
have W_dis : ∀ {s s'}, s ≠ s' → disjoint (W s) (W s'),
{ rintros s s' hss x ⟨⟨hxs_in, hxs_out⟩, ⟨hxs'_in, hxs'_out⟩⟩,
apply hxs'_out,
rw mem_Union₂,
exact ⟨s, hss, hxs_in⟩ },
have hfW : ∀ x, f x ∈ W (S.proj x),
{ intro x,
split,
{ change x ∈ f ⁻¹' (V $ S.proj x),
rw ← hV (S.proj x),
exact mem_singleton _ },
{ intro h,
rcases mem_Union₂.mp h with ⟨s', hss', hfx : x ∈ f ⁻¹' (V s')⟩,
rw ← hV s' at hfx,
exact hss' hfx.symm } },
have W_nonempty : ∀ s, (W s).nonempty,
{ intro s,
obtain ⟨x, hx : S.proj x = s⟩ := S.proj_surjective s,
use f x,
rw ← hx,
apply hfW,
},
let R : S → set Y := λ s, if s = s₀ then W s₀ ∪ (⋃ s, W s)ᶜ else W s,
have W_cl : ∀ s, is_clopen (W s),
{ intro s,
apply (V_cl s).diff,
apply is_clopen_Union,
intro s',
by_cases h : s' = s,
simp [h, is_clopen_empty],
simp [h, V_cl s'] },
have R_cl : ∀ s, is_clopen (R s),
{ intro s,
dsimp [R],
split_ifs,
{ apply (W_cl s₀).union,
apply is_clopen.compl,
exact is_clopen_Union W_cl },
{ exact W_cl _ }, },
let R_part : indexed_partition R,
{ apply indexed_partition.mk',
{ rintros s s' hss x ⟨hxs, hxs'⟩,
dsimp [R] at hxs hxs',
split_ifs at hxs hxs' with hs hs',
{ exact (hss (hs.symm ▸ hs' : s = s')).elim },
{ cases hxs' with hx hx,
{ exact W_dis hs' ⟨hxs, hx⟩ },
{ apply hx,
rw mem_Union,
exact ⟨s, hxs⟩ } },
{ cases hxs with hx hx,
{ exact W_dis hs ⟨hxs', hx⟩ },
{ apply hx,
rw mem_Union,
exact ⟨s', hxs'⟩ } },
{ exact W_dis hss ⟨hxs, hxs'⟩ } },
{ intro s,
dsimp [R],
split_ifs,
{ use (W_nonempty s₀).some,
left,
exact (W_nonempty s₀).some_mem },
{ apply W_nonempty } },
{ intro y,
by_cases hy : ∃ s, y ∈ W s,
{ cases hy with s hys,
use s,
dsimp [R],
split_ifs,
{ left,
rwa h at hys },
{ exact hys } },
{ use s₀,
simp only [R, if_pos rfl],
right,
rwa [mem_compl_iff, mem_Union] } } },
let S' := R_part.discrete_quotient R_cl,
let g := R_part.discrete_quotient_equiv R_cl,
have hR : ∀ x, f x ∈ R (S.proj x),
{ intros x,
by_cases hx : S.proj x = s₀,
{ simp only [hx, R, if_pos rfl],
left,
rw ← hx,
apply hfW },
{ simp only [R, if_neg hx],
apply hfW }, },
use [S', g],
ext x,
change f x ∈ S'.proj ⁻¹' {g (S.proj x)},
rw R_part.discrete_quotient_fiber R_cl,
simpa using hR x,
end
def embedding.discrete_quotient_map [nonempty X] {f : X → Y} (hf : embedding f) (S : discrete_quotient X) :
discrete_quotient Y := (hf.ex_discrete_quotient S).some
def embedding.discrete_quotient_equiv [nonempty X] {f : X → Y} (hf : embedding f) (S : discrete_quotient X) :
S ≃ hf.discrete_quotient_map S :=
(hf.ex_discrete_quotient S).some_spec.some
lemma embedding.discrete_quotient_spec [nonempty X] {f : X → Y} (hf : embedding f) (S : discrete_quotient X) :
(hf.discrete_quotient_map S).proj ∘ f = (hf.discrete_quotient_equiv S) ∘ S.proj :=
(hf.ex_discrete_quotient S).some_spec.some_spec
variables {Z : Type*} [inhabited Z]
open_locale classical
def embedding.extend {e : X → Y} (he : embedding e) (f : X → Z) : Y → Z :=
if h : is_locally_constant f ∧ nonempty X then
by {
haveI := h.2,
let ff : locally_constant X Z := ⟨f,h.1⟩,
let T := he.discrete_quotient_map ff.discrete_quotient,
let ee : ff.discrete_quotient ≃ T := he.discrete_quotient_equiv ff.discrete_quotient,
exact ff.lift ∘ ee.symm ∘ T.proj }
else λ y, default
/- lemma embedding.extend_eq {e : X → Y} (he : embedding e) {f : X → Z} (hf : is_locally_constant f) :
he.extend f = (hf.discrete_quotient_map) ∘ (he.discrete_quotient_equiv hf.discrete_quotient).symm ∘ (he.discrete_quotient_map hf.discrete_quotient).proj
:= dif_pos hf -/
lemma embedding.extend_extends {e : X → Y} (he : embedding e) {f : X → Z} (hf : is_locally_constant f) :
∀ x, he.extend f (e x) = f x :=
begin
intro x,
haveI : nonempty X := ⟨x⟩,
let ff : locally_constant X Z := ⟨f,hf⟩,
let S := ff.discrete_quotient,
let S' := he.discrete_quotient_map S,
let barf : S → Z := ff.lift,
let g : S ≃ S' := he.discrete_quotient_equiv S,
unfold embedding.extend,
have h : is_locally_constant f ∧ nonempty X := ⟨hf, ⟨x⟩⟩,
rw [dif_pos h],
change (barf ∘ g.symm ∘ (S'.proj ∘ e)) x = f x,
suffices : (barf ∘ S.proj) x = f x, by simpa [he.discrete_quotient_spec],
simpa,
end
lemma embedding.is_locally_constant_extend {e : X → Y} (he : embedding e) {f : X → Z} :
is_locally_constant (he.extend f) :=
begin
unfold embedding.extend,
split_ifs,
{ apply is_locally_constant.comp,
apply is_locally_constant.comp,
exact discrete_quotient.proj_is_locally_constant _ },
{ apply is_locally_constant.const },
end
lemma embedding.range_extend {e : X → Y} (he : embedding e)
[nonempty X] {Z : Type*} [inhabited Z] {f : X → Z} (hf : is_locally_constant f) :
range (he.extend f) = range f :=
begin
ext z,
split,
{ rintro ⟨y, rfl⟩,
let ff : locally_constant _ _ := ⟨f,hf⟩,
let T := he.discrete_quotient_map ff.discrete_quotient,
let ee : ff.discrete_quotient ≃ T := he.discrete_quotient_equiv ff.discrete_quotient,
dsimp only [embedding.extend],
rw dif_pos,
swap, { exact ⟨hf, ‹_›⟩ },
change ff.lift (ee.symm (T.proj y)) ∈ _,
rcases ff.discrete_quotient.proj_surjective (ee.symm (T.proj y)) with ⟨w,hz⟩,
use w,
rw ← hz,
refl },
{ rintro ⟨x, rfl⟩,
exact ⟨e x, he.extend_extends hf _⟩ }
end
def embedding.locally_constant_extend {e : X → Y} (he : embedding e) (f : locally_constant X Z) :
locally_constant Y Z :=
⟨he.extend f, he.is_locally_constant_extend⟩
@[simp]
lemma embedding.locally_constant_extend_extends {e : X → Y} (he : embedding e)
(f : locally_constant X Z) (x : X) : he.locally_constant_extend f (e x) = f x :=
he.extend_extends f.2 x
lemma embedding.comap_locally_constant_extend {e : X → Y} (he : embedding e)
(f : locally_constant X Z) : (he.locally_constant_extend f).comap e = f :=
begin
ext x,
rw locally_constant.coe_comap _ _ he.continuous,
exact he.locally_constant_extend_extends f x
end
lemma embedding.range_locally_constant_extend {e : X → Y} (he : embedding e)
[nonempty X] {Z : Type*} [inhabited Z] (f : locally_constant X Z) :
range (he.locally_constant_extend f) = range f :=
he.range_extend f.2
-- version avec comap_hom pour Z normed group ?
|
Definition UU := Type.
Definition dirprodpair {X Y : UU} := existT (fun x : X => Y).
Definition funtoprodtoprod {X Y Z : UU} : { a : X -> Y & X -> Z }.
Proof.
refine (dirprodpair _ (fun x => _)).
|
Load LFindLoad.
From lfind Require Import LFind.
From QuickChick Require Import QuickChick.
From adtind Require Import goal33.
Derive Show for natural.
Derive Arbitrary for natural.
Instance Dec_Eq_natural : Dec_Eq natural.
Proof. dec_eq. Qed.
Lemma conj19eqsynthconj5 : forall (lv0 : natural) (lv1 : natural), (@eq natural (plus (mult lv0 lv1) lv1) (mult (Succ lv0) lv1)).
Admitted.
QuickChick conj19eqsynthconj5.
|
(*
* Copyright Data61, CSIRO (ABN 41 687 119 230)
*
* SPDX-License-Identifier: BSD-2-Clause
*)
section \<open>Legacy aliases\<close>
theory Legacy_Aliases
imports "HOL-Library.Word"
begin
definition
complement :: "'a :: len word \<Rightarrow> 'a word" where
"complement x \<equiv> NOT x"
lemma complement_mask:
"complement (2 ^ n - 1) = NOT (mask n)"
unfolding complement_def mask_eq_decr_exp by simp
lemmas less_def = less_eq [symmetric]
lemmas le_def = not_less [symmetric, where ?'a = nat]
end
|
/-
Copyright (c) 2020 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov, Johannes Hölzl, Mario Carneiro, Patrick Massot
-/
import order.filter.basic
import data.set.countable
/-!
# Filter bases
A filter basis `B : filter_basis α` on a type `α` is a nonempty collection of sets of `α`
such that the intersection of two elements of this collection contains some element of
the collection. Compared to filters, filter bases do not require that any set containing
an element of `B` belongs to `B`.
A filter basis `B` can be used to construct `B.filter : filter α` such that a set belongs
to `B.filter` if and only if it contains an element of `B`.
Given an indexing type `ι`, a predicate `p : ι → Prop`, and a map `s : ι → set α`,
the proposition `h : filter.is_basis p s` makes sure the range of `s` bounded by `p`
(ie. `s '' set_of p`) defines a filter basis `h.filter_basis`.
If one already has a filter `l` on `α`, `filter.has_basis l p s` (where `p : ι → Prop`
and `s : ι → set α` as above) means that a set belongs to `l` if and
only if it contains some `s i` with `p i`. It implies `h : filter.is_basis p s`, and
`l = h.filter_basis.filter`. The point of this definition is that checking statements
involving elements of `l` often reduces to checking them on the basis elements.
We define a function `has_basis.index (h : filter.has_basis l p s) (t) (ht : t ∈ l)` that returns
some index `i` such that `p i` and `s i ⊆ t`. This function can be useful to avoid manual
destruction of `h.mem_iff.mpr ht` using `cases` or `let`.
This file also introduces more restricted classes of bases, involving monotonicity or
countability. In particular, for `l : filter α`, `l.is_countably_generated` means
there is a countable set of sets which generates `s`. This is reformulated in term of bases,
and consequences are derived.
## Main statements
* `has_basis.mem_iff`, `has_basis.mem_of_superset`, `has_basis.mem_of_mem` : restate `t ∈ f`
in terms of a basis;
* `basis_sets` : all sets of a filter form a basis;
* `has_basis.inf`, `has_basis.inf_principal`, `has_basis.prod`, `has_basis.prod_self`,
`has_basis.map`, `has_basis.comap` : combinators to construct filters of `l ⊓ l'`,
`l ⊓ 𝓟 t`, `l ×ᶠ l'`, `l ×ᶠ l`, `l.map f`, `l.comap f` respectively;
* `has_basis.le_iff`, `has_basis.ge_iff`, has_basis.le_basis_iff` : restate `l ≤ l'` in terms
of bases.
* `has_basis.tendsto_right_iff`, `has_basis.tendsto_left_iff`, `has_basis.tendsto_iff` : restate
`tendsto f l l'` in terms of bases.
* `is_countably_generated_iff_exists_antimono_basis` : proves a filter is
countably generated if and only if it admis a basis parametrized by a
decreasing sequence of sets indexed by `ℕ`.
* `tendsto_iff_seq_tendsto ` : an abstract version of "sequentially continuous implies continuous".
## Implementation notes
As with `Union`/`bUnion`/`sUnion`, there are three different approaches to filter bases:
* `has_basis l s`, `s : set (set α)`;
* `has_basis l s`, `s : ι → set α`;
* `has_basis l p s`, `p : ι → Prop`, `s : ι → set α`.
We use the latter one because, e.g., `𝓝 x` in an `emetric_space` or in a `metric_space` has a basis
of this form. The other two can be emulated using `s = id` or `p = λ _, true`.
With this approach sometimes one needs to `simp` the statement provided by the `has_basis`
machinery, e.g., `simp only [exists_prop, true_and]` or `simp only [forall_const]` can help
with the case `p = λ _, true`.
-/
open set filter
open_locale filter classical
variables {α : Type*} {β : Type*} {γ : Type*} {ι : Type*} {ι' : Type*}
/-- A filter basis `B` on a type `α` is a nonempty collection of sets of `α`
such that the intersection of two elements of this collection contains some element
of the collection. -/
structure filter_basis (α : Type*) :=
(sets : set (set α))
(nonempty : sets.nonempty)
(inter_sets {x y} : x ∈ sets → y ∈ sets → ∃ z ∈ sets, z ⊆ x ∩ y)
instance filter_basis.nonempty_sets (B : filter_basis α) : nonempty B.sets := B.nonempty.to_subtype
/-- If `B` is a filter basis on `α`, and `U` a subset of `α` then we can write `U ∈ B` as
on paper. -/
@[reducible]
instance {α : Type*}: has_mem (set α) (filter_basis α) := ⟨λ U B, U ∈ B.sets⟩
-- For illustration purposes, the filter basis defining (at_top : filter ℕ)
instance : inhabited (filter_basis ℕ) :=
⟨{ sets := range Ici,
nonempty := ⟨Ici 0, mem_range_self 0⟩,
inter_sets := begin
rintros _ _ ⟨n, rfl⟩ ⟨m, rfl⟩,
refine ⟨Ici (max n m), mem_range_self _, _⟩,
rintros p p_in,
split ; rw mem_Ici at *,
exact le_of_max_le_left p_in,
exact le_of_max_le_right p_in,
end }⟩
/-- `is_basis p s` means the image of `s` bounded by `p` is a filter basis. -/
protected structure filter.is_basis (p : ι → Prop) (s : ι → set α) : Prop :=
(nonempty : ∃ i, p i)
(inter : ∀ {i j}, p i → p j → ∃ k, p k ∧ s k ⊆ s i ∩ s j)
namespace filter
namespace is_basis
/-- Constructs a filter basis from an indexed family of sets satisfying `is_basis`. -/
protected def filter_basis {p : ι → Prop} {s : ι → set α} (h : is_basis p s) : filter_basis α :=
{ sets := s '' set_of p,
nonempty := let ⟨i, hi⟩ := h.nonempty in ⟨s i, mem_image_of_mem s hi⟩,
inter_sets := by { rintros _ _ ⟨i, hi, rfl⟩ ⟨j, hj, rfl⟩,
rcases h.inter hi hj with ⟨k, hk, hk'⟩,
exact ⟨_, mem_image_of_mem s hk, hk'⟩ } }
variables {p : ι → Prop} {s : ι → set α} (h : is_basis p s)
lemma mem_filter_basis_iff {U : set α} : U ∈ h.filter_basis ↔ ∃ i, p i ∧ s i = U :=
iff.rfl
end is_basis
end filter
namespace filter_basis
/-- The filter associated to a filter basis. -/
protected def filter (B : filter_basis α) : filter α :=
{ sets := {s | ∃ t ∈ B, t ⊆ s},
univ_sets := let ⟨s, s_in⟩ := B.nonempty in ⟨s, s_in, s.subset_univ⟩,
sets_of_superset := λ x y ⟨s, s_in, h⟩ hxy, ⟨s, s_in, set.subset.trans h hxy⟩,
inter_sets := λ x y ⟨s, s_in, hs⟩ ⟨t, t_in, ht⟩,
let ⟨u, u_in, u_sub⟩ := B.inter_sets s_in t_in in
⟨u, u_in, set.subset.trans u_sub $ set.inter_subset_inter hs ht⟩ }
lemma mem_filter_iff (B : filter_basis α) {U : set α} : U ∈ B.filter ↔ ∃ s ∈ B, s ⊆ U :=
iff.rfl
lemma mem_filter_of_mem (B : filter_basis α) {U : set α} : U ∈ B → U ∈ B.filter:=
λ U_in, ⟨U, U_in, subset.refl _⟩
lemma eq_infi_principal (B : filter_basis α) : B.filter = ⨅ s : B.sets, 𝓟 s :=
begin
have : directed (≥) (λ (s : B.sets), 𝓟 (s : set α)),
{ rintros ⟨U, U_in⟩ ⟨V, V_in⟩,
rcases B.inter_sets U_in V_in with ⟨W, W_in, W_sub⟩,
use [W, W_in],
finish },
ext U,
simp [mem_filter_iff, mem_infi this]
end
protected lemma generate (B : filter_basis α) : generate B.sets = B.filter :=
begin
apply le_antisymm,
{ intros U U_in,
rcases B.mem_filter_iff.mp U_in with ⟨V, V_in, h⟩,
exact generate_sets.superset (generate_sets.basic V_in) h },
{ rw sets_iff_generate,
apply mem_filter_of_mem }
end
end filter_basis
namespace filter
namespace is_basis
variables {p : ι → Prop} {s : ι → set α}
/-- Constructs a filter from an indexed family of sets satisfying `is_basis`. -/
protected def filter (h : is_basis p s) : filter α := h.filter_basis.filter
protected lemma mem_filter_iff (h : is_basis p s) {U : set α} :
U ∈ h.filter ↔ ∃ i, p i ∧ s i ⊆ U :=
begin
erw [h.filter_basis.mem_filter_iff],
simp only [mem_filter_basis_iff h, exists_prop],
split,
{ rintros ⟨_, ⟨i, pi, rfl⟩, h⟩,
tauto },
{ tauto }
end
lemma filter_eq_generate (h : is_basis p s) : h.filter = generate {U | ∃ i, p i ∧ s i = U} :=
by erw h.filter_basis.generate ; refl
end is_basis
/-- We say that a filter `l` has a basis `s : ι → set α` bounded by `p : ι → Prop`,
if `t ∈ l` if and only if `t` includes `s i` for some `i` such that `p i`. -/
protected structure has_basis (l : filter α) (p : ι → Prop) (s : ι → set α) : Prop :=
(mem_iff' : ∀ (t : set α), t ∈ l ↔ ∃ i (hi : p i), s i ⊆ t)
section same_type
variables {l l' : filter α} {p : ι → Prop} {s : ι → set α} {t : set α} {i : ι}
{p' : ι' → Prop} {s' : ι' → set α} {i' : ι'}
lemma has_basis_generate (s : set (set α)) :
(generate s).has_basis (λ t, finite t ∧ t ⊆ s) (λ t, ⋂₀ t) :=
⟨begin
intro U,
rw mem_generate_iff,
apply exists_congr,
tauto
end⟩
/-- The smallest filter basis containing a given collection of sets. -/
def filter_basis.of_sets (s : set (set α)) : filter_basis α :=
{ sets := sInter '' { t | finite t ∧ t ⊆ s},
nonempty := ⟨univ, ∅, ⟨⟨finite_empty, empty_subset s⟩, sInter_empty⟩⟩,
inter_sets := begin
rintros _ _ ⟨a, ⟨fina, suba⟩, rfl⟩ ⟨b, ⟨finb, subb⟩, rfl⟩,
exact ⟨⋂₀ (a ∪ b), mem_image_of_mem _ ⟨fina.union finb, union_subset suba subb⟩,
by rw sInter_union⟩,
end }
/-- Definition of `has_basis` unfolded with implicit set argument. -/
lemma has_basis.mem_iff (hl : l.has_basis p s) : t ∈ l ↔ ∃ i (hi : p i), s i ⊆ t :=
hl.mem_iff' t
lemma has_basis_iff : l.has_basis p s ↔ ∀ t, t ∈ l ↔ ∃ i (hi : p i), s i ⊆ t :=
⟨λ ⟨h⟩, h, λ h, ⟨h⟩⟩
lemma has_basis.ex_mem (h : l.has_basis p s) : ∃ i, p i :=
let ⟨i, pi, h⟩ := h.mem_iff.mp univ_mem_sets in ⟨i, pi⟩
protected lemma has_basis.nonempty (h : l.has_basis p s) : nonempty ι :=
nonempty_of_exists h.ex_mem
protected lemma is_basis.has_basis (h : is_basis p s) : has_basis h.filter p s :=
⟨λ t, by simp only [h.mem_filter_iff, exists_prop]⟩
lemma has_basis.mem_of_superset (hl : l.has_basis p s) (hi : p i) (ht : s i ⊆ t) : t ∈ l :=
(hl.mem_iff).2 ⟨i, hi, ht⟩
lemma has_basis.mem_of_mem (hl : l.has_basis p s) (hi : p i) : s i ∈ l :=
hl.mem_of_superset hi $ subset.refl _
/-- Index of a basis set such that `s i ⊆ t` as an element of `subtype p`. -/
noncomputable def has_basis.index (h : l.has_basis p s) (t : set α) (ht : t ∈ l) :
{i : ι // p i} :=
⟨(h.mem_iff.1 ht).some, (h.mem_iff.1 ht).some_spec.fst⟩
lemma has_basis.property_index (h : l.has_basis p s) (ht : t ∈ l) : p (h.index t ht) :=
(h.index t ht).2
lemma has_basis.set_index_mem (h : l.has_basis p s) (ht : t ∈ l) : s (h.index t ht) ∈ l :=
h.mem_of_mem $ h.property_index _
lemma has_basis.set_index_subset (h : l.has_basis p s) (ht : t ∈ l) : s (h.index t ht) ⊆ t :=
(h.mem_iff.1 ht).some_spec.snd
lemma has_basis.is_basis (h : l.has_basis p s) : is_basis p s :=
{ nonempty := let ⟨i, hi, H⟩ := h.mem_iff.mp univ_mem_sets in ⟨i, hi⟩,
inter := λ i j hi hj, by simpa [h.mem_iff]
using l.inter_sets (h.mem_of_mem hi) (h.mem_of_mem hj) }
lemma has_basis.filter_eq (h : l.has_basis p s) : h.is_basis.filter = l :=
by { ext U, simp [h.mem_iff, is_basis.mem_filter_iff] }
lemma has_basis.eq_generate (h : l.has_basis p s) : l = generate { U | ∃ i, p i ∧ s i = U } :=
by rw [← h.is_basis.filter_eq_generate, h.filter_eq]
lemma generate_eq_generate_inter (s : set (set α)) :
generate s = generate (sInter '' { t | finite t ∧ t ⊆ s}) :=
by erw [(filter_basis.of_sets s).generate, ← (has_basis_generate s).filter_eq] ; refl
lemma of_sets_filter_eq_generate (s : set (set α)) : (filter_basis.of_sets s).filter = generate s :=
by rw [← (filter_basis.of_sets s).generate, generate_eq_generate_inter s] ; refl
lemma has_basis.to_has_basis' (hl : l.has_basis p s) (h : ∀ i, p i → ∃ i', p' i' ∧ s' i' ⊆ s i)
(h' : ∀ i', p' i' → s' i' ∈ l) : l.has_basis p' s' :=
begin
refine ⟨λ t, ⟨λ ht, _, λ ⟨i', hi', ht⟩, mem_sets_of_superset (h' i' hi') ht⟩⟩,
rcases hl.mem_iff.1 ht with ⟨i, hi, ht⟩,
rcases h i hi with ⟨i', hi', hs's⟩,
exact ⟨i', hi', subset.trans hs's ht⟩
end
lemma has_basis.to_has_basis (hl : l.has_basis p s) (h : ∀ i, p i → ∃ i', p' i' ∧ s' i' ⊆ s i)
(h' : ∀ i', p' i' → ∃ i, p i ∧ s i ⊆ s' i') : l.has_basis p' s' :=
hl.to_has_basis' h $ λ i' hi', let ⟨i, hi, hss'⟩ := h' i' hi' in hl.mem_iff.2 ⟨i, hi, hss'⟩
lemma has_basis.to_subset (hl : l.has_basis p s) {t : ι → set α} (h : ∀ i, p i → t i ⊆ s i)
(ht : ∀ i, p i → t i ∈ l) : l.has_basis p t :=
hl.to_has_basis' (λ i hi, ⟨i, hi, h i hi⟩) ht
lemma has_basis.eventually_iff (hl : l.has_basis p s) {q : α → Prop} :
(∀ᶠ x in l, q x) ↔ ∃ i, p i ∧ ∀ ⦃x⦄, x ∈ s i → q x :=
by simpa using hl.mem_iff
lemma has_basis.frequently_iff (hl : l.has_basis p s) {q : α → Prop} :
(∃ᶠ x in l, q x) ↔ ∀ i, p i → ∃ x ∈ s i, q x :=
by simp [filter.frequently, hl.eventually_iff]
lemma has_basis.exists_iff (hl : l.has_basis p s) {P : set α → Prop}
(mono : ∀ ⦃s t⦄, s ⊆ t → P t → P s) :
(∃ s ∈ l, P s) ↔ ∃ (i) (hi : p i), P (s i) :=
⟨λ ⟨s, hs, hP⟩, let ⟨i, hi, his⟩ := hl.mem_iff.1 hs in ⟨i, hi, mono his hP⟩,
λ ⟨i, hi, hP⟩, ⟨s i, hl.mem_of_mem hi, hP⟩⟩
lemma has_basis.forall_iff (hl : l.has_basis p s) {P : set α → Prop}
(mono : ∀ ⦃s t⦄, s ⊆ t → P s → P t) :
(∀ s ∈ l, P s) ↔ ∀ i, p i → P (s i) :=
⟨λ H i hi, H (s i) $ hl.mem_of_mem hi,
λ H s hs, let ⟨i, hi, his⟩ := hl.mem_iff.1 hs in mono his (H i hi)⟩
lemma has_basis.ne_bot_iff (hl : l.has_basis p s) :
ne_bot l ↔ (∀ {i}, p i → (s i).nonempty) :=
forall_sets_nonempty_iff_ne_bot.symm.trans $ hl.forall_iff $ λ _ _, nonempty.mono
lemma has_basis.eq_bot_iff (hl : l.has_basis p s) :
l = ⊥ ↔ ∃ i, p i ∧ s i = ∅ :=
not_iff_not.1 $ ne_bot_iff.symm.trans $ hl.ne_bot_iff.trans $
by simp only [not_exists, not_and, ← ne_empty_iff_nonempty]
lemma basis_sets (l : filter α) : l.has_basis (λ s : set α, s ∈ l) id :=
⟨λ t, exists_sets_subset_iff.symm⟩
lemma has_basis_self {l : filter α} {P : set α → Prop} :
has_basis l (λ s, s ∈ l ∧ P s) id ↔ ∀ t ∈ l, ∃ r ∈ l, P r ∧ r ⊆ t :=
begin
simp only [has_basis_iff, exists_prop, id, and_assoc],
exact forall_congr (λ s, ⟨λ h, h.1, λ h, ⟨h, λ ⟨t, hl, hP, hts⟩, mem_sets_of_superset hl hts⟩⟩)
end
/-- If `{s i | p i}` is a basis of a filter `l` and each `s i` includes `s j` such that
`p j ∧ q j`, then `{s j | p j ∧ q j}` is a basis of `l`. -/
lemma has_basis.restrict (h : l.has_basis p s) {q : ι → Prop}
(hq : ∀ i, p i → ∃ j, p j ∧ q j ∧ s j ⊆ s i) :
l.has_basis (λ i, p i ∧ q i) s :=
begin
refine ⟨λ t, ⟨λ ht, _, λ ⟨i, hpi, hti⟩, h.mem_iff.2 ⟨i, hpi.1, hti⟩⟩⟩,
rcases h.mem_iff.1 ht with ⟨i, hpi, hti⟩,
rcases hq i hpi with ⟨j, hpj, hqj, hji⟩,
exact ⟨j, ⟨hpj, hqj⟩, subset.trans hji hti⟩
end
/-- If `{s i | p i}` is a basis of a filter `l` and `V ∈ l`, then `{s i | p i ∧ s i ⊆ V}`
is a basis of `l`. -/
lemma has_basis.restrict_subset (h : l.has_basis p s) {V : set α} (hV : V ∈ l) :
l.has_basis (λ i, p i ∧ s i ⊆ V) s :=
h.restrict $ λ i hi, (h.mem_iff.1 (inter_mem_sets hV (h.mem_of_mem hi))).imp $
λ j hj, ⟨hj.fst, subset_inter_iff.1 hj.snd⟩
lemma has_basis.has_basis_self_subset {p : set α → Prop} (h : l.has_basis (λ s, s ∈ l ∧ p s) id)
{V : set α} (hV : V ∈ l) : l.has_basis (λ s, s ∈ l ∧ p s ∧ s ⊆ V) id :=
by simpa only [and_assoc] using h.restrict_subset hV
theorem has_basis.ge_iff (hl' : l'.has_basis p' s') : l ≤ l' ↔ ∀ i', p' i' → s' i' ∈ l :=
⟨λ h i' hi', h $ hl'.mem_of_mem hi',
λ h s hs, let ⟨i', hi', hs⟩ := hl'.mem_iff.1 hs in mem_sets_of_superset (h _ hi') hs⟩
theorem has_basis.le_iff (hl : l.has_basis p s) : l ≤ l' ↔ ∀ t ∈ l', ∃ i (hi : p i), s i ⊆ t :=
by simp only [le_def, hl.mem_iff]
theorem has_basis.le_basis_iff (hl : l.has_basis p s) (hl' : l'.has_basis p' s') :
l ≤ l' ↔ ∀ i', p' i' → ∃ i (hi : p i), s i ⊆ s' i' :=
by simp only [hl'.ge_iff, hl.mem_iff]
lemma has_basis.ext (hl : l.has_basis p s) (hl' : l'.has_basis p' s')
(h : ∀ i, p i → ∃ i', p' i' ∧ s' i' ⊆ s i)
(h' : ∀ i', p' i' → ∃ i, p i ∧ s i ⊆ s' i') : l = l' :=
begin
apply le_antisymm,
{ rw hl.le_basis_iff hl',
simpa using h' },
{ rw hl'.le_basis_iff hl,
simpa using h },
end
lemma has_basis.inf (hl : l.has_basis p s) (hl' : l'.has_basis p' s') :
(l ⊓ l').has_basis (λ i : ι × ι', p i.1 ∧ p' i.2) (λ i, s i.1 ∩ s' i.2) :=
⟨begin
intro t,
simp only [mem_inf_sets, exists_prop, hl.mem_iff, hl'.mem_iff],
split,
{ rintros ⟨t, ⟨i, hi, ht⟩, t', ⟨i', hi', ht'⟩, H⟩,
use [(i, i'), ⟨hi, hi'⟩, subset.trans (inter_subset_inter ht ht') H] },
{ rintros ⟨⟨i, i'⟩, ⟨hi, hi'⟩, H⟩,
use [s i, i, hi, subset.refl _, s' i', i', hi', subset.refl _, H] }
end⟩
lemma has_basis_principal (t : set α) : (𝓟 t).has_basis (λ i : unit, true) (λ i, t) :=
⟨λ U, by simp⟩
lemma has_basis.sup (hl : l.has_basis p s) (hl' : l'.has_basis p' s') :
(l ⊔ l').has_basis (λ i : ι × ι', p i.1 ∧ p' i.2) (λ i, s i.1 ∪ s' i.2) :=
⟨begin
intros t,
simp only [mem_sup_sets, hl.mem_iff, hl'.mem_iff, prod.exists, union_subset_iff, exists_prop,
and_assoc, exists_and_distrib_left],
simp only [← and_assoc, exists_and_distrib_right, and_comm]
end⟩
lemma has_basis.inf_principal (hl : l.has_basis p s) (s' : set α) :
(l ⊓ 𝓟 s').has_basis p (λ i, s i ∩ s') :=
⟨λ t, by simp only [mem_inf_principal, hl.mem_iff, subset_def, mem_set_of_eq,
mem_inter_iff, and_imp]⟩
lemma has_basis.inf_basis_ne_bot_iff (hl : l.has_basis p s) (hl' : l'.has_basis p' s') :
ne_bot (l ⊓ l') ↔ ∀ ⦃i⦄ (hi : p i) ⦃i'⦄ (hi' : p' i'), (s i ∩ s' i').nonempty :=
(hl.inf hl').ne_bot_iff.trans $ by simp [@forall_swap _ ι']
lemma has_basis.inf_ne_bot_iff (hl : l.has_basis p s) :
ne_bot (l ⊓ l') ↔ ∀ ⦃i⦄ (hi : p i) ⦃s'⦄ (hs' : s' ∈ l'), (s i ∩ s').nonempty :=
hl.inf_basis_ne_bot_iff l'.basis_sets
lemma has_basis.inf_principal_ne_bot_iff (hl : l.has_basis p s) {t : set α} :
ne_bot (l ⊓ 𝓟 t) ↔ ∀ ⦃i⦄ (hi : p i), (s i ∩ t).nonempty :=
(hl.inf_principal t).ne_bot_iff
lemma inf_ne_bot_iff :
ne_bot (l ⊓ l') ↔ ∀ ⦃s : set α⦄ (hs : s ∈ l) ⦃s'⦄ (hs' : s' ∈ l'), (s ∩ s').nonempty :=
l.basis_sets.inf_ne_bot_iff
lemma inf_principal_ne_bot_iff {s : set α} :
ne_bot (l ⊓ 𝓟 s) ↔ ∀ U ∈ l, (U ∩ s).nonempty :=
l.basis_sets.inf_principal_ne_bot_iff
lemma inf_eq_bot_iff {f g : filter α} :
f ⊓ g = ⊥ ↔ ∃ (U ∈ f) (V ∈ g), U ∩ V = ∅ :=
not_iff_not.1 $ ne_bot_iff.symm.trans $ inf_ne_bot_iff.trans $
by simp [← ne_empty_iff_nonempty]
protected lemma disjoint_iff {f g : filter α} :
disjoint f g ↔ ∃ (U ∈ f) (V ∈ g), U ∩ V = ∅ :=
disjoint_iff.trans inf_eq_bot_iff
lemma mem_iff_inf_principal_compl {f : filter α} {s : set α} :
s ∈ f ↔ f ⊓ 𝓟 sᶜ = ⊥ :=
begin
refine not_iff_not.1 ((inf_principal_ne_bot_iff.trans _).symm.trans ne_bot_iff),
exact ⟨λ h hs, by simpa [empty_not_nonempty] using h s hs,
λ hs t ht, inter_compl_nonempty_iff.2 $ λ hts, hs $ mem_sets_of_superset ht hts⟩,
end
lemma not_mem_iff_inf_principal_compl {f : filter α} {s : set α} :
s ∉ f ↔ ne_bot (f ⊓ 𝓟 sᶜ) :=
(not_congr mem_iff_inf_principal_compl).trans ne_bot_iff.symm
lemma mem_iff_disjoint_principal_compl {f : filter α} {s : set α} :
s ∈ f ↔ disjoint f (𝓟 sᶜ) :=
mem_iff_inf_principal_compl.trans disjoint_iff.symm
lemma le_iff_forall_disjoint_principal_compl {f g : filter α} :
f ≤ g ↔ ∀ V ∈ g, disjoint f (𝓟 Vᶜ) :=
forall_congr $ λ _, forall_congr $ λ _, mem_iff_disjoint_principal_compl
lemma le_iff_forall_inf_principal_compl {f g : filter α} :
f ≤ g ↔ ∀ V ∈ g, f ⊓ 𝓟 Vᶜ = ⊥ :=
forall_congr $ λ _, forall_congr $ λ _, mem_iff_inf_principal_compl
lemma inf_ne_bot_iff_frequently_left {f g : filter α} :
ne_bot (f ⊓ g) ↔ ∀ {p : α → Prop}, (∀ᶠ x in f, p x) → ∃ᶠ x in g, p x :=
by simpa only [inf_ne_bot_iff, frequently_iff, exists_prop, and_comm]
lemma inf_ne_bot_iff_frequently_right {f g : filter α} :
ne_bot (f ⊓ g) ↔ ∀ {p : α → Prop}, (∀ᶠ x in g, p x) → ∃ᶠ x in f, p x :=
by { rw inf_comm, exact inf_ne_bot_iff_frequently_left }
lemma has_basis.eq_binfi (h : l.has_basis p s) :
l = ⨅ i (_ : p i), 𝓟 (s i) :=
eq_binfi_of_mem_sets_iff_exists_mem $ λ t, by simp only [h.mem_iff, mem_principal_sets]
lemma has_basis.eq_infi (h : l.has_basis (λ _, true) s) :
l = ⨅ i, 𝓟 (s i) :=
by simpa only [infi_true] using h.eq_binfi
lemma has_basis_infi_principal {s : ι → set α} (h : directed (≥) s) [nonempty ι] :
(⨅ i, 𝓟 (s i)).has_basis (λ _, true) s :=
⟨begin
refine λ t, (mem_infi (h.mono_comp _ _) t).trans $
by simp only [exists_prop, true_and, mem_principal_sets],
exact λ _ _, principal_mono.2
end⟩
/-- If `s : ι → set α` is an indexed family of sets, then finite intersections of `s i` form a basis
of `⨅ i, 𝓟 (s i)`. -/
lemma has_basis_infi_principal_finite (s : ι → set α) :
(⨅ i, 𝓟 (s i)).has_basis (λ t : set ι, finite t) (λ t, ⋂ i ∈ t, s i) :=
begin
refine ⟨λ U, (mem_infi_finite _).trans _⟩,
simp only [infi_principal_finset, mem_Union, mem_principal_sets, exists_prop,
exists_finite_iff_finset, finset.set_bInter_coe]
end
lemma has_basis_binfi_principal {s : β → set α} {S : set β} (h : directed_on (s ⁻¹'o (≥)) S)
(ne : S.nonempty) :
(⨅ i ∈ S, 𝓟 (s i)).has_basis (λ i, i ∈ S) s :=
⟨begin
refine λ t, (mem_binfi _ ne).trans $ by simp only [mem_principal_sets],
rw [directed_on_iff_directed, ← directed_comp, (∘)] at h ⊢,
apply h.mono_comp _ _,
exact λ _ _, principal_mono.2
end⟩
lemma has_basis_binfi_principal'
(h : ∀ i, p i → ∀ j, p j → ∃ k (h : p k), s k ⊆ s i ∧ s k ⊆ s j) (ne : ∃ i, p i) :
(⨅ i (h : p i), 𝓟 (s i)).has_basis p s :=
filter.has_basis_binfi_principal h ne
lemma has_basis.map (f : α → β) (hl : l.has_basis p s) :
(l.map f).has_basis p (λ i, f '' (s i)) :=
⟨λ t, by simp only [mem_map, image_subset_iff, hl.mem_iff, preimage]⟩
lemma has_basis.comap (f : β → α) (hl : l.has_basis p s) :
(l.comap f).has_basis p (λ i, f ⁻¹' (s i)) :=
⟨begin
intro t,
simp only [mem_comap_sets, exists_prop, hl.mem_iff],
split,
{ rintros ⟨t', ⟨i, hi, ht'⟩, H⟩,
exact ⟨i, hi, subset.trans (preimage_mono ht') H⟩ },
{ rintros ⟨i, hi, H⟩,
exact ⟨s i, ⟨i, hi, subset.refl _⟩, H⟩ }
end⟩
lemma comap_has_basis (f : α → β) (l : filter β) :
has_basis (comap f l) (λ s : set β, s ∈ l) (λ s, f ⁻¹' s) :=
⟨λ t, mem_comap_sets⟩
lemma has_basis.prod_self (hl : l.has_basis p s) :
(l ×ᶠ l).has_basis p (λ i, (s i).prod (s i)) :=
⟨begin
intro t,
apply mem_prod_iff.trans,
split,
{ rintros ⟨t₁, ht₁, t₂, ht₂, H⟩,
rcases hl.mem_iff.1 (inter_mem_sets ht₁ ht₂) with ⟨i, hi, ht⟩,
exact ⟨i, hi, λ p ⟨hp₁, hp₂⟩, H ⟨(ht hp₁).1, (ht hp₂).2⟩⟩ },
{ rintros ⟨i, hi, H⟩,
exact ⟨s i, hl.mem_of_mem hi, s i, hl.mem_of_mem hi, H⟩ }
end⟩
lemma mem_prod_self_iff {s} : s ∈ l ×ᶠ l ↔ ∃ t ∈ l, set.prod t t ⊆ s :=
l.basis_sets.prod_self.mem_iff
lemma has_basis.sInter_sets (h : has_basis l p s) :
⋂₀ l.sets = ⋂ i ∈ set_of p, s i :=
begin
ext x,
suffices : (∀ t ∈ l, x ∈ t) ↔ ∀ i, p i → x ∈ s i,
by simpa only [mem_Inter, mem_set_of_eq, mem_sInter],
simp_rw h.mem_iff,
split,
{ intros h i hi,
exact h (s i) ⟨i, hi, subset.refl _⟩ },
{ rintros h _ ⟨i, hi, sub⟩,
exact sub (h i hi) },
end
variables [preorder ι] (l p s)
/-- `is_antimono_basis p s` means the image of `s` bounded by `p` is a filter basis
such that `s` is decreasing and `p` is increasing, ie `i ≤ j → p i → p j`. -/
structure is_antimono_basis extends is_basis p s : Prop :=
(decreasing : ∀ {i j}, p i → p j → i ≤ j → s j ⊆ s i)
(mono : monotone p)
/-- We say that a filter `l` has a antimono basis `s : ι → set α` bounded by `p : ι → Prop`,
if `t ∈ l` if and only if `t` includes `s i` for some `i` such that `p i`,
and `s` is decreasing and `p` is increasing, ie `i ≤ j → p i → p j`. -/
structure has_antimono_basis [preorder ι] (l : filter α) (p : ι → Prop) (s : ι → set α)
extends has_basis l p s : Prop :=
(decreasing : ∀ {i j}, p i → p j → i ≤ j → s j ⊆ s i)
(mono : monotone p)
end same_type
section two_types
variables {la : filter α} {pa : ι → Prop} {sa : ι → set α}
{lb : filter β} {pb : ι' → Prop} {sb : ι' → set β} {f : α → β}
lemma has_basis.tendsto_left_iff (hla : la.has_basis pa sa) :
tendsto f la lb ↔ ∀ t ∈ lb, ∃ i (hi : pa i), ∀ x ∈ sa i, f x ∈ t :=
by { simp only [tendsto, (hla.map f).le_iff, image_subset_iff], refl }
lemma has_basis.tendsto_right_iff (hlb : lb.has_basis pb sb) :
tendsto f la lb ↔ ∀ i (hi : pb i), ∀ᶠ x in la, f x ∈ sb i :=
by simp only [tendsto, hlb.ge_iff, mem_map, filter.eventually]
lemma has_basis.tendsto_iff (hla : la.has_basis pa sa) (hlb : lb.has_basis pb sb) :
tendsto f la lb ↔ ∀ ib (hib : pb ib), ∃ ia (hia : pa ia), ∀ x ∈ sa ia, f x ∈ sb ib :=
by simp [hlb.tendsto_right_iff, hla.eventually_iff]
lemma tendsto.basis_left (H : tendsto f la lb) (hla : la.has_basis pa sa) :
∀ t ∈ lb, ∃ i (hi : pa i), ∀ x ∈ sa i, f x ∈ t :=
hla.tendsto_left_iff.1 H
lemma tendsto.basis_right (H : tendsto f la lb) (hlb : lb.has_basis pb sb) :
∀ i (hi : pb i), ∀ᶠ x in la, f x ∈ sb i :=
hlb.tendsto_right_iff.1 H
lemma tendsto.basis_both (H : tendsto f la lb) (hla : la.has_basis pa sa)
(hlb : lb.has_basis pb sb) :
∀ ib (hib : pb ib), ∃ ia (hia : pa ia), ∀ x ∈ sa ia, f x ∈ sb ib :=
(hla.tendsto_iff hlb).1 H
lemma has_basis.prod (hla : la.has_basis pa sa) (hlb : lb.has_basis pb sb) :
(la ×ᶠ lb).has_basis (λ i : ι × ι', pa i.1 ∧ pb i.2) (λ i, (sa i.1).prod (sb i.2)) :=
(hla.comap prod.fst).inf (hlb.comap prod.snd)
lemma has_basis.prod' {la : filter α} {lb : filter β} {ι : Type*} {p : ι → Prop}
{sa : ι → set α} {sb : ι → set β}
(hla : la.has_basis p sa) (hlb : lb.has_basis p sb)
(h_dir : ∀ {i j}, p i → p j → ∃ k, p k ∧ sa k ⊆ sa i ∧ sb k ⊆ sb j) :
(la ×ᶠ lb).has_basis p (λ i, (sa i).prod (sb i)) :=
⟨begin
intros t,
rw mem_prod_iff,
split,
{ rintros ⟨u, u_in, v, v_in, huv⟩,
rcases hla.mem_iff.mp u_in with ⟨i, hi, si⟩,
rcases hlb.mem_iff.mp v_in with ⟨j, hj, sj⟩,
rcases h_dir hi hj with ⟨k, hk, ki, kj⟩,
use [k, hk],
calc
(sa k).prod (sb k) ⊆ (sa i).prod (sb j) : set.prod_mono ki kj
... ⊆ u.prod v : set.prod_mono si sj
... ⊆ t : huv, },
{ rintro ⟨i, hi, h⟩,
exact ⟨sa i, hla.mem_of_mem hi, sb i, hlb.mem_of_mem hi, h⟩ },
end⟩
end two_types
/-- `is_countably_generated f` means `f = generate s` for some countable `s`. -/
def is_countably_generated (f : filter α) : Prop :=
∃ s : set (set α), countable s ∧ f = generate s
/-- `is_countable_basis p s` means the image of `s` bounded by `p` is a countable filter basis. -/
structure is_countable_basis (p : ι → Prop) (s : ι → set α) extends is_basis p s : Prop :=
(countable : countable $ set_of p)
/-- We say that a filter `l` has a countable basis `s : ι → set α` bounded by `p : ι → Prop`,
if `t ∈ l` if and only if `t` includes `s i` for some `i` such that `p i`, and the set
defined by `p` is countable. -/
structure has_countable_basis (l : filter α) (p : ι → Prop) (s : ι → set α)
extends has_basis l p s : Prop :=
(countable : countable $ set_of p)
/-- A countable filter basis `B` on a type `α` is a nonempty countable collection of sets of `α`
such that the intersection of two elements of this collection contains some element
of the collection. -/
structure countable_filter_basis (α : Type*) extends filter_basis α :=
(countable : countable sets)
-- For illustration purposes, the countable filter basis defining (at_top : filter ℕ)
instance nat.inhabited_countable_filter_basis : inhabited (countable_filter_basis ℕ) :=
⟨{ countable := countable_range (λ n, Ici n),
..(default $ filter_basis ℕ),}⟩
lemma antimono_seq_of_seq (s : ℕ → set α) :
∃ t : ℕ → set α, (∀ i j, i ≤ j → t j ⊆ t i) ∧ (⨅ i, 𝓟 $ s i) = ⨅ i, 𝓟 (t i) :=
begin
use λ n, ⋂ m ≤ n, s m, split,
{ exact λ i j hij, bInter_mono' (Iic_subset_Iic.2 hij) (λ n hn, subset.refl _) },
apply le_antisymm; rw le_infi_iff; intro i,
{ rw le_principal_iff, refine (bInter_mem_sets (finite_le_nat _)).2 (λ j hji, _),
rw ← le_principal_iff, apply infi_le_of_le j _, apply le_refl _ },
{ apply infi_le_of_le i _, rw principal_mono, intro a, simp, intro h, apply h, refl },
end
lemma countable_binfi_eq_infi_seq [complete_lattice α] {B : set ι} (Bcbl : countable B)
(Bne : B.nonempty) (f : ι → α) :
∃ (x : ℕ → ι), (⨅ t ∈ B, f t) = ⨅ i, f (x i) :=
begin
rw countable_iff_exists_surjective_to_subtype Bne at Bcbl,
rcases Bcbl with ⟨g, gsurj⟩,
rw infi_subtype',
use (λ n, g n), apply le_antisymm; rw le_infi_iff,
{ intro i, apply infi_le_of_le (g i) _, apply le_refl _ },
{ intros a, rcases gsurj a with ⟨i, rfl⟩, apply infi_le }
end
lemma countable_binfi_eq_infi_seq' [complete_lattice α] {B : set ι} (Bcbl : countable B) (f : ι → α)
{i₀ : ι} (h : f i₀ = ⊤) :
∃ (x : ℕ → ι), (⨅ t ∈ B, f t) = ⨅ i, f (x i) :=
begin
cases B.eq_empty_or_nonempty with hB Bnonempty,
{ rw [hB, infi_emptyset],
use λ n, i₀,
simp [h] },
{ exact countable_binfi_eq_infi_seq Bcbl Bnonempty f }
end
lemma countable_binfi_principal_eq_seq_infi {B : set (set α)} (Bcbl : countable B) :
∃ (x : ℕ → set α), (⨅ t ∈ B, 𝓟 t) = ⨅ i, 𝓟 (x i) :=
countable_binfi_eq_infi_seq' Bcbl 𝓟 principal_univ
namespace is_countably_generated
/-- A set generating a countably generated filter. -/
def generating_set {f : filter α} (h : is_countably_generated f) :=
classical.some h
lemma countable_generating_set {f : filter α} (h : is_countably_generated f) :
countable h.generating_set :=
(classical.some_spec h).1
lemma eq_generate {f : filter α} (h : is_countably_generated f) :
f = generate h.generating_set :=
(classical.some_spec h).2
/-- A countable filter basis for a countably generated filter. -/
def countable_filter_basis {l : filter α} (h : is_countably_generated l) :
countable_filter_basis α :=
{ countable := (countable_set_of_finite_subset h.countable_generating_set).image _,
..filter_basis.of_sets (h.generating_set) }
lemma filter_basis_filter {l : filter α} (h : is_countably_generated l) :
h.countable_filter_basis.to_filter_basis.filter = l :=
begin
conv_rhs { rw h.eq_generate },
apply of_sets_filter_eq_generate,
end
lemma has_countable_basis {l : filter α} (h : is_countably_generated l) :
l.has_countable_basis (λ t, finite t ∧ t ⊆ h.generating_set) (λ t, ⋂₀ t) :=
⟨by convert has_basis_generate _ ; exact h.eq_generate,
countable_set_of_finite_subset h.countable_generating_set⟩
lemma exists_countable_infi_principal {f : filter α} (h : f.is_countably_generated) :
∃ s : set (set α), countable s ∧ f = ⨅ t ∈ s, 𝓟 t :=
begin
let B := h.countable_filter_basis,
use [B.sets, B.countable],
rw ← h.filter_basis_filter,
rw B.to_filter_basis.eq_infi_principal,
rw infi_subtype''
end
lemma exists_seq {f : filter α} (cblb : f.is_countably_generated) :
∃ x : ℕ → set α, f = ⨅ i, 𝓟 (x i) :=
begin
rcases cblb.exists_countable_infi_principal with ⟨B, Bcbl, rfl⟩,
exact countable_binfi_principal_eq_seq_infi Bcbl,
end
/-- If `f` is countably generated and `f.has_basis p s`, then `f` admits a decreasing basis
enumerated by natural numbers such that all sets have the form `s i`. More precisely, there is a
sequence `i n` such that `p (i n)` for all `n` and `s (i n)` is a decreasing sequence of sets which
forms a basis of `f`-/
lemma exists_antimono_subbasis {f : filter α} (cblb : f.is_countably_generated)
{p : ι → Prop} {s : ι → set α} (hs : f.has_basis p s) :
∃ x : ℕ → ι, (∀ i, p (x i)) ∧ f.has_antimono_basis (λ _, true) (λ i, s (x i)) :=
begin
rcases cblb.exists_seq with ⟨x', hx'⟩,
have : ∀ i, x' i ∈ f := λ i, hx'.symm ▸ (infi_le (λ i, 𝓟 (x' i)) i) (mem_principal_self _),
let x : ℕ → {i : ι // p i} := λ n, nat.rec_on n (hs.index _ $ this 0)
(λ n xn, (hs.index _ $ inter_mem_sets (this $ n + 1) (hs.mem_of_mem xn.coe_prop))),
have x_mono : ∀ n : ℕ, s (x n.succ) ⊆ s (x n) :=
λ n, subset.trans (hs.set_index_subset _) (inter_subset_right _ _),
replace x_mono : ∀ ⦃i j⦄, i ≤ j → s (x j) ≤ s (x i),
{ refine @monotone_of_monotone_nat (order_dual $ set α) _ _ _,
exact x_mono },
have x_subset : ∀ i, s (x i) ⊆ x' i,
{ rintro (_|i),
exacts [hs.set_index_subset _, subset.trans (hs.set_index_subset _) (inter_subset_left _ _)] },
refine ⟨λ i, x i, λ i, (x i).2, _⟩,
have : (⨅ i, 𝓟 (s (x i))).has_antimono_basis (λ _, true) (λ i, s (x i)) :=
⟨has_basis_infi_principal (directed_of_sup x_mono), λ i j _ _ hij, x_mono hij, monotone_const⟩,
convert this,
exact le_antisymm (le_infi $ λ i, le_principal_iff.2 $ by cases i; apply hs.set_index_mem)
(hx'.symm ▸ le_infi (λ i, le_principal_iff.2 $
this.to_has_basis.mem_iff.2 ⟨i, trivial, x_subset i⟩))
end
/-- A countably generated filter admits a basis formed by a monotonically decreasing sequence of
sets. -/
lemma exists_antimono_basis {f : filter α} (cblb : f.is_countably_generated) :
∃ x : ℕ → set α, f.has_antimono_basis (λ _, true) x :=
let ⟨x, hxf, hx⟩ := cblb.exists_antimono_subbasis f.basis_sets in ⟨x, hx⟩
end is_countably_generated
lemma has_countable_basis.is_countably_generated {f : filter α} {p : ι → Prop} {s : ι → set α}
(h : f.has_countable_basis p s) :
f.is_countably_generated :=
⟨{t | ∃ i, p i ∧ s i = t}, h.countable.image s, h.to_has_basis.eq_generate⟩
lemma is_countably_generated_seq (x : ℕ → set α) : is_countably_generated (⨅ i, 𝓟 $ x i) :=
begin
rcases antimono_seq_of_seq x with ⟨y, am, h⟩,
rw h,
use [range y, countable_range _],
rw (has_basis_infi_principal _).eq_generate,
{ simp [range] },
{ exact directed_of_sup am },
{ use 0 },
end
lemma is_countably_generated_of_seq {f : filter α} (h : ∃ x : ℕ → set α, f = ⨅ i, 𝓟 $ x i) :
f.is_countably_generated :=
let ⟨x, h⟩ := h in by rw h ; apply is_countably_generated_seq
lemma is_countably_generated_binfi_principal {B : set $ set α} (h : countable B) :
is_countably_generated (⨅ (s ∈ B), 𝓟 s) :=
is_countably_generated_of_seq (countable_binfi_principal_eq_seq_infi h)
lemma is_countably_generated_iff_exists_antimono_basis {f : filter α} :
is_countably_generated f ↔ ∃ x : ℕ → set α, f.has_antimono_basis (λ _, true) x :=
begin
split,
{ exact λ h, h.exists_antimono_basis },
{ rintros ⟨x, h⟩,
rw h.to_has_basis.eq_infi,
exact is_countably_generated_seq x },
end
lemma is_countably_generated_principal (s : set α) : is_countably_generated (𝓟 s) :=
begin
rw show 𝓟 s = ⨅ i : ℕ, 𝓟 s, by simp,
apply is_countably_generated_seq
end
namespace is_countably_generated
lemma inf {f g : filter α} (hf : is_countably_generated f) (hg : is_countably_generated g) :
is_countably_generated (f ⊓ g) :=
begin
rw is_countably_generated_iff_exists_antimono_basis at hf hg,
rcases hf with ⟨s, hs⟩,
rcases hg with ⟨t, ht⟩,
exact has_countable_basis.is_countably_generated
⟨hs.to_has_basis.inf ht.to_has_basis, set.countable_encodable _⟩
end
lemma inf_principal {f : filter α} (h : is_countably_generated f) (s : set α) :
is_countably_generated (f ⊓ 𝓟 s) :=
h.inf (filter.is_countably_generated_principal s)
lemma exists_antimono_seq' {f : filter α} (cblb : f.is_countably_generated) :
∃ x : ℕ → set α, (∀ i j, i ≤ j → x j ⊆ x i) ∧ ∀ {s}, (s ∈ f ↔ ∃ i, x i ⊆ s) :=
let ⟨x, hx⟩ := is_countably_generated_iff_exists_antimono_basis.mp cblb in
⟨x, λ i j, hx.decreasing trivial trivial, λ s, by simp [hx.to_has_basis.mem_iff]⟩
protected lemma comap {l : filter β} (h : l.is_countably_generated) (f : α → β) :
(comap f l).is_countably_generated :=
let ⟨x, hx_mono⟩ := h.exists_antimono_basis in
is_countably_generated_of_seq ⟨_, (hx_mono.to_has_basis.comap _).eq_infi⟩
end is_countably_generated
end filter
|
{-# LANGUAGE RecordWildCards #-}
import Data.Complex (realPart, imagPart)
import Diagrams.Backend.CmdLine (mainRender)
import Diagrams.Backend.Rasterific.CmdLine ()
import Args (parseArgs, Args(..))
import ExponentialSum (expSums)
import Plot (display)
main :: IO ()
main = do
Args{..} <- parseArgs
mainRender options $ display $ select start end $ getPoints coeffs
where
getPoints = map toCoords . expSums . map fromIntegral
select st en = take (en - st) . drop st
toCoords z = (realPart z, imagPart z)
|
```python
from itertools import product
import numpy as np
from scipy import optimize
from scipy import interpolate
import sympy as sm
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
plt.style.use('seaborn')
import seaborn as sns
%load_ext autoreload
%autoreload 2
import ASAD
```
# 1. Human capital accumulation
The **parameters** of the model are:
```python
rho = 2
beta = 0.96
gamma = 0.1
b = 1
w = 2
Delta = 0.1
```
The **relevant levels of human capital** are:
```python
h_vec = np.linspace(0.1,1.5,100)
```
The **basic functions** are:
```python
def consumption_utility(c,rho):
""" utility of consumption
Args:
c (float): consumption
rho (float): CRRA parameter
Returns:
(float): utility of consumption
"""
return c**(1-rho)/(1-rho)
def labor_disutility(l,gamma):
""" disutility of labor
Args:
l (int): labor supply
gamma (float): disutility of labor parameter
Returns:
(float): disutility of labor
"""
return gamma*l
def consumption(h,l,w,b):
""" consumption
Args:
h (float): human capital
l (int): labor supply
w (float): wage rate
b (float): unemployment benefits
Returns:
(float): consumption
"""
if l == 1:
return w*h
else:
return b
```
The **value-of-choice functions** are:
```python
def v2(l2,h2,b,w,rho,gamma):
""" value-of-choice in period 2
Args:
l2 (int): labor supply
h2 (float): human capital
w (float): wage rate
b (float): unemployment benefits
rho (float): CRRA parameter
gamma (float): disutility of labor parameter
Returns:
(float): value-of-choice in period 2
"""
c2 = consumption(h2,l2,w,b)
return consumption_utility(c2,rho)-labor_disutility(l2,gamma)
def v1(l1,h1,b,w,rho,gamma,Delta,v2_interp,eta=1):
""" value-of-choice in period 1
Args:
l1 (int): labor supply
h1 (float): human capital
w (float): wage rate
b (float): unemployment benefits
rho (float): CRRA parameter
gamma (float): disutility of labor parameter
Delta (float): potential stochastic experience gain
v2_interp (RegularGridInterpolator): interpolator for value-of-choice in period 2
eta (float,optional): scaling of determistic experience gain
Returns:
(float): value-of-choice in period 1
"""
# a. v2 value, if no experience gain
h2_low = h1 + eta*l1 + 0
v2_low = v2_interp([h2_low])[0]
# b. v2 value, if experience gain
h2_high = h1 + eta*l1 + Delta
v2_high = v2_interp([h2_high])[0]
# c. expected v2 value
v2 = 0.5*v2_low + 0.5*v2_high
# d. consumption
c1 = consumption(h1,l1,w,b)
# e. total value
return consumption_utility(c1,rho) - labor_disutility(l1,gamma) + beta*v2
```
A **general solution function** is:
```python
def solve(h_vec,obj_func):
""" solve for optimal labor choice
Args:
h_vec (ndarray): human capital
obj_func (callable): objective function
Returns:
l_vec (ndarray): labor supply choices
v_vec (ndarray): implied values-of-choices
"""
# a. grids
v_vec = np.empty(h_vec.size)
l_vec = np.empty(h_vec.size)
# b. solve for each h in grid
for i,h in enumerate(h_vec):
# i. values of choices
v_nowork = obj_func(0,h)
v_work = obj_func(1,h)
# ii. maximum
if v_nowork > v_work:
v_vec[i] = v_nowork
l_vec[i] = 0
else:
v_vec[i] = v_work
l_vec[i] = 1
return l_vec,v_vec
```
A **general plotting funcition** is:
```python
def plot(h_vec,l_vec,v_vec,t):
""" plot optimal choices and value function
Args:
h_vec (ndarray): human capital
l_vec (ndarray): labor supply choices
v_vec (ndarray): implied values-of-choices
t (int): period
"""
# a. labor supply function
fig = plt.figure(figsize=(10,4))
ax = fig.add_subplot(1,2,1)
ax.plot(h_vec,l_vec,label='labor supply')
# income
ax.plot(h_vec,w*h_vec,'--',label='wage income')
ax.plot(h_vec,b*np.ones(h_vec.size),'--',label='unemployment benefits')
# working with income loss
I = (l_vec == 1) & (w*h_vec < b)
if np.any(I):
ax.fill_between(h_vec[I],w*h_vec[I],b*np.ones(I.sum()),label='working with income loss')
ax.set_xlabel(f'$h_{t}$')
ax.set_ylabel(f'$l_{t}$')
ax.set_title(f'labor supply function in period {t}')
ax.legend()
# b. value function
ax = fig.add_subplot(1,2,2)
ax.plot(h_vec,v_vec,label='value function')
ax.set_xlabel(f'$h_{t}$')
ax.set_ylabel(f'$v_{t}$')
ax.set_title(f'value function in period {t}')
ax.legend()
```
## Question 1
The solution in the **second period** is:
```python
# a. solve
obj_func = lambda l2,h2: v2(l2,h2,b,w,rho,gamma)
l2_vec,v2_vec = solve(h_vec,obj_func)
# b. plot
plot(h_vec,l2_vec,v2_vec,2)
```
## Question 2
The solution in the **first period** is:
```python
# a. create interpolator
v2_interp = interpolate.RegularGridInterpolator((h_vec,), v2_vec,
bounds_error=False,fill_value=None)
# b. solve
obj_func = lambda l1,h1: v1(l1,h1,b,w,rho,gamma,Delta,v2_interp)
l1_vec,v1_vec = solve(h_vec,obj_func)
# c. plot
plot(h_vec,l1_vec,v1_vec,1)
```
## Question 3
1. In **period 2**, the worker only works if her potential wage income ($wh_2$) is higher than the unemployment benefits ($b$).
2. In **period 1**, the worker might work even when she looses income in the current period compared to getting unemployment benefits. The explanation is that she accumulates human capital by working which increase her utility in period 2.
To explain this further, consider the following **alternative problem**:
$$
\begin{aligned}
v_{1}(h_{1}) &= \max_{l_{1}} \frac{c_1^{1-\rho}}{1-\rho} - \gamma l_1 + \beta\mathbb{E}_{1}\left[v_2(h_2)\right] \\
\text{s.t.} \\
c_{1}& = \begin{cases}
w h_1 &
\text{if }l_1 = 1 \\
b & \text{if }l_1 = 0
\end{cases} \\
h_2 &= h_1 + \eta l_1 + \begin{cases}
0 & \text{with prob. }0.5\\
\Delta & \text{with prob. }0.5
\end{cases}\\
l_{1} &\in \{0,1\}\\
\end{aligned}
$$
where $\eta$ scales the deterministic experience gain from working. Before we had $\eta = 1$.
If we instead set $\eta = 0$, then the worker will only works in period 1 if $wh_2 > b$ by a margin compensating her for the utility loss of working.
```python
# a. solve
obj_func = lambda l1,h1: v1(l1,h1,b,w,rho,gamma,Delta,v2_interp,eta=0)
l1_vec,v1_vec = solve(h_vec,obj_func)
# b. plot
plot(h_vec,l1_vec,v1_vec,1)
```
# 2. AS-AD model
```python
par = {}
par['alpha'] = 5.76
par['h'] = 0.5
par['b'] = 0.5
par['phi'] = 0
par['gamma'] = 0.075
```
```python
par['delta'] = 0.80
par['omega'] = 0.15
```
```python
par['sigma_x'] = 3.492
par['sigma_c'] = 0.2
```
## Question 1
```python
sm.init_printing(use_unicode=True)
```
Construct the **AD-curve:**
```python
y = sm.symbols('y_t')
v = sm.symbols('v_t')
alpha = sm.symbols('alpha')
h = sm.symbols('h')
b = sm.symbols('b')
AD = 1/(h*alpha)*(v-(1+b*alpha)*y)
AD
```
Construct the **SRAS-curve:**
```python
phi = sm.symbols('phi')
gamma = sm.symbols('gamma')
pilag = sm.symbols('\pi_{t-1}')
ylag = sm.symbols('y_{t-1}')
s = sm.symbols('s_t')
slag = sm.symbols('s_{t-1}')
SRAS = pilag + gamma*y- phi*gamma*ylag + s - phi*slag
SRAS
```
**Find solution:**
```python
y_eq = sm.solve(sm.Eq(AD,SRAS),y)
y_eq[0]
```
```python
pi_eq = AD.subs(y,y_eq[0])
pi_eq
```
```python
sm.init_printing(pretty_print=False)
```
## Question 2
Create **Python functions**:
```python
AD_func = sm.lambdify((y,v,alpha,h,b),AD)
SRAS_func = sm.lambdify((y,s,ylag,pilag,slag,phi,gamma),SRAS)
y_eq_func = sm.lambdify((ylag,pilag,v,s,slag,alpha,h,b,phi,gamma),y_eq[0])
pi_eq_func = sm.lambdify((ylag,pilag,v,s,slag,alpha,h,b,phi,gamma),pi_eq)
```
**Illustrate equilibrium:**
```python
# a. lagged values and shocks
y0_lag = 0.0
pi0_lag = 0.0
s0 = 0.0
s0_lag = 0.0
# b. current output
y_vec = np.linspace(-0.2,0.2,100)
# c. figure
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
# SRAS
pi_SRAS = SRAS_func(y_vec,s0,y0_lag,pi0_lag,s0_lag,par['phi'],par['gamma'])
ax.plot(y_vec,pi_SRAS,label='SRAS')
# ADs
for v0 in [0, 0.1]:
pi_AD = AD_func(y_vec,v0,par['alpha'],par['h'],par['b'])
ax.plot(y_vec,pi_AD,label=f'AD ($v_0 = {v0})$')
# equilibrium
eq_y = y_eq_func(y0_lag,pi0_lag,v0,s0,s0_lag,par['alpha'],par['h'],par['b'],par['phi'],par['gamma'])
eq_pi =pi_eq_func(y0_lag,pi0_lag,v0,s0,s0_lag,par['alpha'],par['h'],par['b'],par['phi'],par['gamma'])
ax.scatter(eq_y,eq_pi,color='black',zorder=3)
ax.set_xlabel('$y_t$')
ax.set_ylabel('$\pi_t$')
ax.legend();
```
## Question 3
**Allocate memory and draw random shocks**:
```python
def prep_sim(par,T,seed=1986):
""" prepare simulation
Args:
par (dict): model parameters
T (int): number of periods to simulate
seed (int,optional): seed for random numbers
Returns:
sim (dict): container for simulation results
"""
# a. set seed
if not seed == None:
np.random.seed(seed)
# b. allocate memory
sim = {}
sim['y'] = np.zeros(T)
sim['pi'] = np.zeros(T)
sim['v'] = np.zeros(T)
sim['s'] = np.zeros(T)
# c. draw random shocks
sim['x_raw'] = np.random.normal(loc=0,scale=1,size=T)
sim['c_raw'] = np.random.normal(loc=0,scale=1,size=T)
return sim
```
**Simualte** for $T$ periods:
```python
def simulate(par,sim,T):
""" run simulation
Args:
par (dict): model parameters
sim (dict): container for simulation results
T (int): number of periods to simulate
"""
for t in range(1,T):
# a. shocks
sim['v'][t] = par['delta']*sim ['v'][t-1] + par['sigma_x']*sim['x_raw'][t]
sim['s'][t] = par['omega']*sim ['s'][t-1] + par['sigma_c']*sim['c_raw'][t]
# b. output
sim['y'][t] = y_eq_func(sim['y'][t-1],sim['pi'][t-1],sim['v'][t],sim['s'][t],sim['s'][t-1],
par['alpha'],par['h'],par['b'],par['phi'],par['gamma'])
# c. inflation
sim['pi'][t] = pi_eq_func(sim['y'][t-1],sim['pi'][t-1],sim['v'][t],sim['s'][t],sim['s'][t-1],
par['alpha'],par['h'],par['b'],par['phi'],par['gamma'])
```
```python
# a. settings
T = 101
# b. prepare simulation
sim = prep_sim(par,T)
# c. overview shocks
sim['x_raw'][:] = 0
sim['c_raw'][:] = 0
sim ['x_raw'][1] = 0.1/par['sigma_x']
# d. run simulation
simulate(par,sim,T)
```
**$(y_t,\pi_t)$-diagram:**
```python
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
ax.plot(sim['y'][1:],sim['pi'][1:],ls='-',marker='o')
ax.set_xlabel('$y_t$')
ax.set_ylabel('$\pi_t$');
for i in range(1,7):
ax.text(sim['y'][i],sim['pi'][i]+0.0002,f't = {i}')
```
**Time paths:**
```python
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
ax.plot(np.arange(0,T-1),sim['y'][1:],label='$y_t$, output gap')
ax.plot(np.arange(0,T-1),sim['pi'][1:],label='$\pi_t$, inflation gap')
ax.legend();
```
## Question 4
```python
# a. simulate
T = 1000
sim = prep_sim(par,T)
simulate(par,sim,T)
# b. figure
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
ax.plot(np.arange(T),sim['y'],label='$y_t$, output gap')
ax.plot(np.arange(T),sim['pi'],label='$\pi_t$, inflation gap')
ax.legend();
# c. print
def print_sim(sim):
print(f'std. of output gap: {np.std(sim["y"]):.4f}')
print(f'std. of inflation gap: {np.std(sim["pi"]):.4f}')
print(f'correlation of output and inflation gap: {np.corrcoef(sim["y"],sim["pi"])[0,1]:.4f}')
print(f'1st order autocorrelation of output gap: {np.corrcoef(sim["y"][1:],sim["y"][:-1])[0,1]:.4f}')
print(f'1st order autocorrelation of inflation gap: {np.corrcoef(sim["pi"][1:],sim["pi"][:-1])[0,1]:.4f}')
print_sim(sim)
```
### Quesiton 5
**The initial plot:**
```python
# a. calculate correlations
K = 100
phis = np.linspace(0.01,0.99,K)
corr_y_pi = np.empty(K)
est = par.copy()
for i,phi in enumerate(phis):
# i. update
est['phi'] = phi
# ii. simulate
simulate(est,sim,T)
# iii. save
corr_y_pi[i] = np.corrcoef(sim["y"],sim["pi"])[0,1]
# b. plot
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
ax.plot(phis,corr_y_pi)
ax.set_xlabel('$\phi$')
ax.set_ylabel('corr($y_t,\pi_t$)');
```
**The optimization:**
```python
# a. copy parameters
est = par.copy()
# b. objective funciton
def obj_func(x,est,sim,T,sim_func):
""" calculate objective function for estimation of phi
Args:
x (float): trial value for phi
est (dict): model parameters
sim (dict): container for simulation results
T (int): number of periods to simulate
sim_func (callable): simulation function
Returns:
obj (float): objective value
"""
# i. phi
est['phi'] = x
# ii. simulate
sim_func(est,sim,T)
# iii. calcualte objective
obj = (np.corrcoef(sim["y"],sim["pi"])[0,1]-0.31)**2
return obj
# c. optimize
result = optimize.minimize_scalar(obj_func,args=(est,sim,T,simulate),
bounds=(0+1e-8,1-1e-8),method='bounded')
# d. result
est['phi'] = result.x
print(f'result: phi = {result.x:.3f}')
# e. statistics
print('')
simulate(est,sim,T)
print_sim(sim)
```
result: phi = 0.963
std. of output gap: 1.5264
std. of inflation gap: 0.2726
correlation of output and inflation gap: 0.3100
1st order autocorrelation of output gap: 0.8184
1st order autocorrelation of inflation gap: 0.5559
### Advanced
**Problem:** The estimate for $\phi$ above depends on the seed chosen for the random number generator. This can be illustrated by re-doing the estimation for different seeds:
```python
seeds = [1997,1,17,2018,999] # "randomly chosen seeds"
for seed in seeds:
# a. prepare simulate
sim_alt = prep_sim(par,T,seed)
# b. run optimizer
result = optimize.minimize_scalar(obj_func,args=(est,sim_alt,T,simulate),bounds=(0+1e-8,1-1e-8),method='bounded')
result_alt = optimize.minimize_scalar(obj_func,args=(est,sim_alt,T,ASAD.simulate),bounds=(0+1e-8,1-1e-8),method='bounded')
print(f'seed = {seed:4d}: phi = {result.x:.3f} [{result_alt.x:.3f}]')
```
seed = 1997: phi = 0.949 [0.949]
seed = 1: phi = 0.973 [0.973]
seed = 17: phi = 0.985 [0.985]
seed = 2018: phi = 0.926 [0.926]
seed = 999: phi = 0.949 [0.949]
**Solution:** To reduce this problem, we need to simulate more than 1,000 periods. To do so it is beneficial to use the fast simulation function provided in **ASAD.py** (optimized using numba):
1. The results in the square brackets above show that this simulation function gives the same results.
2. The results below show that when we simulate 1,000,000 periods the estimate of $\phi$ is approximately 0.983-0.984 irrespective of the seed.
```python
T_alt = 1_000_000
for seed in [1997,1,17,2018,999]:
# a. simulate
sim_alt = prep_sim(par,T_alt,seed)
# b. run optimizer
result = optimize.minimize_scalar(obj_func,args=(est,sim_alt,T_alt,ASAD.simulate),bounds=(0+1e-8,1-1e-8),method='bounded')
print(f'seed = {seed:4d}: phi = {result.x:.3f}')
```
seed = 1997: phi = 0.985
seed = 1: phi = 0.984
seed = 17: phi = 0.983
seed = 2018: phi = 0.983
seed = 999: phi = 0.984
## Question 6
```python
# a. copy parameters
est = par.copy()
# b. objective function
def obj_func_all(x,est,sim,T,sim_func):
""" calculate objective function for estimation of phi, sigma_c and sigma_c
Args:
x (ndarray): trial values for [phi,sigma_x,sigma_c]
est (dict): model parameters
sim (dict): container for simulation results
T (int): number of periods to simulate
sim_func (callable): simulation function
Returns:
obj (float): objective value
"""
# i. phi with penalty
penalty = 0
if x[0] < 1e-8:
phi = 1e-8
penalty += (1-1e-8-x[0])**2
elif x[0] > 1-1e-8:
phi = 1-1e-8
penalty += (1-1e-8-x[0])**2
else:
phi = x[0]
est['phi'] = phi
# ii. standard deviations (forced to be non-negative)
est['sigma_x'] = np.sqrt(x[1]**2)
est['sigma_c'] = np.sqrt(x[2]**2)
# iii. simulate
sim_func(est,sim,T)
# iv. calcualte objective
obj = 0
obj += (np.std(sim['y'])-1.64)**2
obj += (np.std(sim['pi'])-0.21)**2
obj += (np.corrcoef(sim['y'],sim['pi'])[0,1]-0.31)**2
obj += (np.corrcoef(sim['y'][1:],sim['y'][:-1])[0,1]-0.84)**2
obj += (np.corrcoef(sim['pi'][1:],sim['pi'][:-1])[0,1]-0.48)**2
return obj + penalty
# c. optimize
x0 = [0.98,par['sigma_x'],par['sigma_c']]
result = optimize.minimize(obj_func_all,x0,args=(est,sim,T,simulate))
print(result)
# d. update and print estimates
est['phi'] = result.x[0]
est['sigma_x'] = np.sqrt(result.x[1]**2)
est['sigma_c'] = np.sqrt(result.x[2]**2)
est_str = ''
est_str += f'phi = {est["phi"]:.3f}, '
est_str += f'sigma_x = {est["sigma_x"]:.3f}, '
est_str += f'sigma_c = {est["sigma_c"]:.3f}'
print(f'\n{est_str}\n')
# e. statistics
sim = prep_sim(est,T)
simulate(est,sim,T)
print_sim(sim)
```
fun: 0.005339800735277895
hess_inv: array([[ 5.09040330e-03, 8.38489388e-03, -2.52877550e-03],
[ 8.38489388e-03, 2.56633371e+00, 9.15285507e-02],
[-2.52877550e-03, 9.15285507e-02, 8.15174802e-02]])
jac: array([ 9.33842966e-06, 5.05708158e-07, -7.71949999e-07])
message: 'Optimization terminated successfully.'
nfev: 55
nit: 7
njev: 11
status: 0
success: True
x: array([0.97189233, 3.72758982, 0.21646031])
phi = 0.972, sigma_x = 3.728, sigma_c = 0.216
std. of output gap: 1.6295
std. of inflation gap: 0.2728
correlation of output and inflation gap: 0.3385
1st order autocorrelation of output gap: 0.8183
1st order autocorrelation of inflation gap: 0.4772
### Advanced
**Same problem:** Different seeds give different results.
```python
for seed in seeds:
# a. prepare simulation
sim_alt = prep_sim(par,T,seed)
# b. run optimizer
est = par.copy()
x0 = [0.98,par['sigma_x'],par['sigma_c']]
result = optimize.minimize(obj_func_all,x0,args=(est,sim_alt,T,simulate))
# c. update and print estimates
est['phi'] = result.x[0]
est['sigma_x'] = np.sqrt(result.x[1]**2)
est['sigma_c'] = np.sqrt(result.x[2]**2)
est_str = ''
est_str += f' phi = {est["phi"]:.3f},'
est_str += f' sigma_x = {est["sigma_x"]:.3f},'
est_str += f' sigma_c = {est["sigma_c"]:.3f}'
print(f'seed = {seed:4d}: {est_str}')
```
seed = 1997: phi = 0.958, sigma_x = 4.305, sigma_c = 0.231
seed = 1: phi = 0.969, sigma_x = 4.246, sigma_c = 0.217
seed = 17: phi = 0.975, sigma_x = 4.109, sigma_c = 0.206
seed = 2018: phi = 0.956, sigma_x = 4.027, sigma_c = 0.240
seed = 999: phi = 0.962, sigma_x = 3.665, sigma_c = 0.207
**Same solution:** Simulate more periods (and use the faster simulation function).
```python
T_alt = 1_000_000
for seed in seeds:
# a. simulate
sim_alt = prep_sim(par,T_alt,seed)
# b. run optimizer
est = par.copy()
x0 = [0.98,par['sigma_x'],par['sigma_c']]
result = optimize.minimize(obj_func_all,x0,args=(est,sim_alt,T_alt,ASAD.simulate))
# c. update and print estimates
est['phi'] = result.x[0]
est['sigma_x'] = np.sqrt(result.x[1]**2)
est['sigma_c'] = np.sqrt(result.x[2]**2)
est_str = ''
est_str += f' phi = {est["phi"]:.3f},'
est_str += f' sigma_x = {est["sigma_x"]:.3f},'
est_str += f' sigma_c = {est["sigma_c"]:.3f}'
print(f'seed = {seed:4d}: {est_str}')
```
seed = 1997: phi = 0.990, sigma_x = 3.994, sigma_c = 0.222
seed = 1: phi = 0.990, sigma_x = 3.982, sigma_c = 0.222
seed = 17: phi = 0.989, sigma_x = 3.984, sigma_c = 0.222
seed = 2018: phi = 0.989, sigma_x = 3.974, sigma_c = 0.222
seed = 999: phi = 0.990, sigma_x = 3.990, sigma_c = 0.222
# 3. Exchange economy
```python
# a. parameters
N = 50_000
mu = np.array([3,2,1])
Sigma = np.array([[0.25, 0, 0], [0, 0.25, 0], [0, 0, 0.25]])
zeta = 1
gamma = 0.8
# b. random draws
seed = 1986
np.random.seed(seed)
# preferences
alphas = np.exp(np.random.multivariate_normal(mu,Sigma,size=N))
betas = alphas/np.reshape(np.sum(alphas,axis=1),(N,1))
# endowments
e1 = np.random.exponential(zeta,size=N)
e2 = np.random.exponential(zeta,size=N)
e3 = np.random.exponential(zeta,size=N)
```
## Question 1
```python
# a. calculate
budgetshares = betas
# b. histograms
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
for i in range(3):
ax.hist(budgetshares[:,i],bins=100,alpha=0.7,density=True)
```
## Question 2
```python
def excess_demands(budgetshares,p1,p2,e1,e2,e3):
""" calculate excess demands for good 1, 2 and 3
Args:
budgetshares (ndarray): budgetshares for each good for all consumers
p1 (float): price of good 1
p2 (float): price of good 2
e1 (ndrarray): endowments of good 1
e2 (ndrarray): endowments of good 2
e3 (ndrarray): endowments of good 3
Returns:
ed_1 (float): excess demands for good 1
ed_2 (float): excess demands for good 2
ed_3 (float): excess demands for good 3
"""
# a. income
I = p1*e1+p2*e2+1*e3
# b. demands
demand_1 = np.sum(budgetshares[:,0]*I/p1)
demand_2 = np.sum(budgetshares[:,1]*I/p2)
demand_3 = np.sum(budgetshares[:,2]*I) # p3 = 1, numeraire
# b. supply
supply_1 = np.sum(e1)
supply_2 = np.sum(e2)
supply_3 = np.sum(e3)
# c. excess demand
ed_1 = demand_1-supply_1
ed_2 = demand_2-supply_2
ed_3 = demand_3-supply_3
return ed_1,ed_2,ed_3
```
```python
# a. calculate on grid
K = 50
p1_vec = np.linspace(4,8,K)
p2_vec = np.linspace(0.5,8,K)
p1_mat,p2_mat = np.meshgrid(p1_vec,p2_vec,indexing='ij')
ed1_mat = np.empty((K,K))
ed2_mat = np.empty((K,K))
ed3_mat = np.empty((K,K))
for (i,p1),(j,p2) in product(enumerate(p1_vec),enumerate(p2_vec)):
ed1_mat[i,j],ed2_mat[i,j],ed3_mat[i,j] = excess_demands(budgetshares,p1,p2,e1,e2,e3)
# b. plot
fig = plt.figure()
ax = fig.add_subplot(1,1,1,projection='3d')
ax.plot_wireframe(p1_mat,p2_mat,ed1_mat/N)
ax.plot_surface(p1_mat,p2_mat,np.zeros((K,K)),alpha=0.5,color='black',zorder=99)
ax.set_xlabel('$p_1$')
ax.set_ylabel('$p_2$')
ax.set_title('excess demand for good 1')
ax.invert_xaxis()
fig.tight_layout()
fig = plt.figure()
ax = fig.add_subplot(1,1,1,projection='3d')
ax.plot_wireframe(p1_mat,p2_mat,ed2_mat/N)
ax.plot_surface(p1_mat,p2_mat,np.zeros((K,K)),alpha=0.5,color='black',zorder=99)
ax.set_title('excess demand for good 2')
ax.set_xlabel('$p_1$')
ax.set_ylabel('$p_2$')
ax.invert_xaxis();
fig.tight_layout()
fig = plt.figure()
ax = fig.add_subplot(1,1,1,projection='3d')
ax.plot_wireframe(p1_mat,p2_mat,ed3_mat/N)
ax.plot_surface(p1_mat,p2_mat,np.zeros((K,K)),alpha=0.5,color='black',zorder=99)
ax.set_title('excess demand for good 3')
ax.set_xlabel('$p_1$')
ax.set_ylabel('$p_2$')
ax.invert_xaxis();
fig.tight_layout()
```
## Questions 3
**Function for finding the equilibrium:**
```python
def find_equilibrium(budgetshares,p1,p2,e1,e2,e3,kappa=0.5,eps=1e-8,maxiter=5000):
""" find equilibrium prices
Args:
budgetshares (ndarray): budgetshares for each good for all consumers
p1 (float): price of good 1
p2 (float): price of good 2
e1 (ndrarray): endowments of good 1
e2 (ndrarray): endowments of good 2
e3 (ndrarray): endowments of good 3
kappa (float,optional): adjustment aggresivity parameter
eps (float,optional): tolerance for convergence
maxiter (int,optinal): maximum number of iteration
Returns:
p1 (ndarray): equilibrium price for good 1
p2 (ndarray): equilibrium price for good 2
"""
it = 0
while True:
# a. step 1: excess demands
ed_1,ed_2,_ed3 = excess_demands(budgetshares,p1,p2,e1,e2,e3)
# b: step 2: stop?
if (np.abs(ed_1) < eps and np.abs(ed_2) < eps) or it >= maxiter:
print(f'(p1,p2) = [{p1:.4f} {p2:.4f}] -> excess demands = [{ed_1:.4f} {ed_2:.4f}] (iterations: {it})')
break
# c. step 3: update p1 and p2
N = budgetshares.shape[0]
p1 = p1 + kappa*ed_1/N
p2 = p2 + kappa*ed_2/N
# d. step 4: return
it += 1
return p1,p2
```
**Apply algorithm:**
```python
# a. guess prices are equal to the average beta
betas_mean = np.mean(betas,axis=0)
p1_guess,p2_guess,_p3_guess = betas_mean/betas_mean[-1]
# b. find equilibrium
p1,p2 = find_equilibrium(budgetshares,p1_guess,p2_guess,e1,e2,e3)
```
(p1,p2) = [6.4901 2.6167] -> excess demands = [0.0000 0.0000] (iterations: 2416)
**Check excess demands:**
```python
assert np.all(np.abs(np.array(excess_demands(budgetshares,p1,p2,e1,e2,e3)) < 1e-6))
```
## Questions 4
```python
# a. income
I = p1*e1+p2*e2+1*e3
# b. baseline utility
x = budgetshares*np.reshape(I,(N,1))/np.array([p1,p2,1])
base_utility = np.prod(x**betas,axis=1)
# c. plot utility
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
for gamma_now in [gamma,1.0,1.2]:
utility = base_utility**gamma_now
ax.hist(utility,bins=100,density=True,
label=f'$\gamma = {gamma_now:.2f}$: mean(u) = {np.mean(utility):.3f}, var(u) = {np.var(utility):.3f}')
ax.legend();
```
### Question 5
```python
# a. equalize endowments
e1_equal = np.repeat(np.mean(e1),N)
e2_equal = np.repeat(np.mean(e2),N)
e3_equal = np.repeat(np.mean(e3),N)
print(f'e_equal = [{e1_equal[0]:.2f},{e2_equal[0]:.2f},{e3_equal[0]:.2f}]')
# b. find equilibrium
p1_equal,p2_equal = find_equilibrium(budgetshares,p1_guess,p2_guess,e1_equal,e2_equal,e3_equal)
```
e_equal = [1.00,0.99,1.00]
(p1,p2) = [6.4860 2.6172] -> excess demands = [0.0000 0.0000] (iterations: 2404)
**Check excess demands:**
```python
assert np.all(np.abs(np.array(excess_demands(budgetshares,p1_equal,p2_equal,e1_equal,e2_equal,e3_equal))< 1e-6))
```
**Plot utility:**
```python
# a. income
I_equal = p1_equal*e1_equal+p2_equal*e2_equal+1*e3_equal
# b. baseline utility
x = budgetshares*np.reshape(I_equal,(N,1))/np.array([p1_equal,p2_equal,1])
base_utility_equal = np.prod(x**betas,axis=1)
# c. plot utility
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
for gamma_now in [gamma,1.0,1.2]:
utility = base_utility_equal**gamma_now
ax.hist(utility,bins=100,density=True,
label=f'$\gamma = {gamma_now:.2f}$: mean(u) = {np.mean(utility):.3f}, var(u) = {np.var(utility):.3f}')
ax.legend();
```
**Compare prices with baseline:**
```python
print(f'baseline: p1 = {p1:.4f}, p2 = {p2:.4f}')
print(f' equal: p1 = {p1_equal:.4f}, p2 = {p2_equal:.4f}')
```
baseline: p1 = 6.4901, p2 = 2.6167
equal: p1 = 6.4860, p2 = 2.6172
**Conclusions:** The relative prices of good 1 and good 2 *increase* slightly when endowments are equalized. (This can, however, be shown to disappear when $N \rightarrow \infty$.)
Economic behavior (demand and supply), and therefore equilibrium prices, are independent of $\gamma$, which thus only affects utility.
Irrespective of $\gamma$ we have:
1. Equalization of endowments implies a utility floor of approximately 1 because everyone then get approximately one unit of each good.
2. The variance of utility always decreases when endowments are equalized.
3. The remaining inequality in utility when endowments are equalized must be driven by preferences (see below).
The effect on the mean of utility of equalizing endowments depends on whether $\gamma$ is below, equal to or above one:
1. For $\gamma = 0.8 < 1.0$ the mean utility *increases* ("decreasing returns to scale").
2. For $\gamma = 1.0$ the mean utility is *unchanged* ("constant returns to scale").
3. For $\gamma = 1.2 > 1.0$ the utility mean *decreases* ("increasing returns to scale").
**Additional observation:** When endowments are equalized those with high utility have preferences which differ from the mean.
```python
for i in range(3):
sns.jointplot(betas[:,i],base_utility_equal,kind='hex').set_axis_labels(f'$\\beta^j_{i+1}$','utility')
```
|
module get_dims
implicit none
private
public :: get_dims_data_point, get_dims_data_elem, get_dims_interp
contains
!======================== get_dims_data_point ================================80
subroutine get_dims_data_point(funit,n_data)
use string_utils, only : geti
implicit none
integer :: funit, n_data, iostatus
character(len=2048) :: line
continue
n_data = 0
rewind(funit)
do while (iostatus==0)
read(funit,'(a)',iostat=iostatus) line
n_data=geti(line,'i')
if (n_data /= 0) exit
end do
if (n_data == 0) stop 'err n_data = 0'
end subroutine get_dims_data_point
!========================= get_dims_data_elem ================================80
subroutine get_dims_data_elem(funit,n_data,nelem_data)
use string_utils, only : geti
implicit none
integer :: funit, n_data,nelem_data,iostatus
character(len=2048) :: line
continue
n_data = 0
nelem_data=0
rewind(funit)
do while (iostatus==0)
read(funit,'(a)',iostat=iostatus) line
n_data=geti(line,'i')
nelem_data=geti(line,'j')
if (n_data /= 0) exit
end do
if (n_data == 0 .or. nelem_data == 0) stop 'err dims_data = 0'
end subroutine get_dims_data_elem
!============================= get_dims_interp ===============================80
subroutine get_dims_interp(funit,n_interp,nelem_interp)
use utils, only : nthword
integer :: funit, n_interp,ic,nelem_interp
character(len=2048) :: line,word
continue
n_interp = 0
nelem_interp = 0
rewind(funit)
ic = len('zone t')
do
read(funit, '(a)',end=1) line
line = adjustl(line)
if (line(:ic) == 'zone t') then
word = nthword(line, 5)
word = word(3:)
read(word,*) n_interp
word = nthword(line, 6)
word = word(3:)
read(word,*) nelem_interp
return
end if
end do
1 continue
if (n_interp == 0.or.nelem_interp == 0) &
stop 'err n_interp or nelem_interp = 0'
end subroutine get_dims_interp
end module get_dims
|
## compare DNAm values from ONT to Array values
filterRD<-function(data, threshold){
return(data[which(data$called_sites/data$num_motifs_in_group > threshold),])
}
setwd("DNAmethylation/")
files<-list.files("Nanopolish/", pattern = "_methylation_frequency.tsv", recursive=TRUE)
ont.nano<-lapply(paste0("Nanopolish/",files), read.table, header = TRUE)
## only consider CpGs with at least 10 reads.
ont.nano.filt<-lapply(ont.nano, filterRD, 10)
## convert to GRanges
sam1<-GRanges(seqnames = ont.nano.filt[[1]]$chromosome, strand = "*", ranges = IRanges(start = ont.nano.filt[[1]]$start, end = ont.nano.filt[[1]]$end), DNAm = ont.nano.filt[[1]]$methylated_frequency, Reads = ont.nano.filt[[1]]$called_sites, Coverage = ont.nano.filt[[1]]$called_sites/ont.nano.filt[[1]]$num_motifs_in_group, nCpG = ont.nano.filt[[1]]$num_motifs_in_group)
sam2<-GRanges(seqnames = ont.nano.filt[[2]]$chromosome, strand = "*", ranges = IRanges(start = ont.nano.filt[[2]]$start, end = ont.nano.filt[[2]]$end), DNAm = ont.nano.filt[[2]]$methylated_frequency, Reads = ont.nano.filt[[2]]$called_sites, Coverage = ont.nano.filt[[2]]$called_sites/ont.nano.filt[[2]]$num_motifs_in_group, nCpG = ont.nano.filt[[2]]$num_motifs_in_group)
## focus in on target regions
allGuides<-read.csv("../Resources/SmokingEWAS/GuideRNAsFINAL.csv")
targetRegions<-cbind(aggregate(allGuides$hg38, by = list(allGuides$Chr), min), aggregate(allGuides$hg38, by = list(allGuides$Chr), max)$x)
targetGRanges<-GRanges(seqnames = paste0("chr", targetRegions[,1]), strand = "*", ranges = IRanges(start = targetRegions[,2], end = targetRegions[,3]))
inTargets1<-subsetByOverlaps(sam1, targetGRanges)
inTargets2<-subsetByOverlaps(sam2, targetGRanges)
### how many overlapping sites ?
sharedSites<-findOverlaps(inTargets1, inTargets2)
allCpGs<-union(inTargets1, inTargets2)
<<<<<<< HEAD
=======
>>>>>>> 638f31e2662b1d1498cd237a8809634e886c7425
aggregate(inTargets1$nCpG, by = list(as.character(seqnames(inTargets1))), sum)
aggregate(inTargets2$nCpG, by = list(as.character(seqnames(inTargets2))), sum)
aggregate(inTargets1$nCpG[queryHits(sharedSites)], by = list(as.character(seqnames(inTargets1[queryHits(sharedSites)]))), sum)
## first genome-wide correlations and error metrics
load("../Resources/SmokingEWAS/ArrayData.rda")
probeAnno<-read.table("/gpfs/mrc0/projects/Research_Project-MRC190311/References/EPICArray/EPIC.anno.GRCh38.tsv", header = TRUE, fill = TRUE)
probeAnno<-probeAnno[match(rownames(smokebetas), probeAnno$probeID),]
arrayData<-GRanges(seqnames = probeAnno$chrm, strand = "*", ranges = IRanges(start = probeAnno$start, end = probeAnno$end), smokebetas)
## count number of sites on EPIC array within these regions
epicOverlap<-subsetByOverlaps(arrayData, targetGRanges)
table(seqnames(epicOverlap))
## compare the spacing profile
<<<<<<< HEAD
intraDist<-NULL
for(i in 1:length(targetGRanges)){
subCpGs<-allCpGs[which(as.character(seqnames(allCpGs)) == as.character(seqnames(targetGRanges)[i])),]
intraDist<-c(intraDist, width(gaps(allCpGs)))
## Need to add in distances between CpGs called in a single region
## calculate average distance
}
=======
for(i in 1:length(targetGRanges)){
subCpGs<-allCpGs[which(as.character(seqnames(allCpGs)) == as.character(seqnames(targetGRanges)[i]),]
width(gaps(allCpGs))
}
>>>>>>> 638f31e2662b1d1498cd237a8809634e886c7425
overlapArray1<-findOverlaps(sam1, arrayData)
overlapArray2<-findOverlaps(sam2, arrayData)
## need to double check which sample is which.
pdf("Plots/ScatterplotDNAmArrayvsNanopolishGenomewide.pdf", width = 10, height = 5)
par(mfrow = c(1,2))
plot(sam1$DNAm[queryHits(overlapArray1)], arrayData$"Non-Smoker"[subjectHits(overlapArray1)], pch = 16, xlab = "ONT", ylab = "EPIC array")
mtext(side = 3, line = 0, adj = 1, paste0("cor = ", signif(cor(sam1$DNAm[queryHits(overlapArray1)], arrayData$"Non-Smoker"[subjectHits(overlapArray1)]),3), "; n = ", length(overlapArray1), " sites"))
plot(sam2$DNAm[queryHits(overlapArray2)], arrayData$Smoker[subjectHits(overlapArray2)], pch = 16, xlab = "ONT", ylab = "EPIC array")
mtext(side = 3, line = 0, adj = 1, paste0("cor = ", signif(cor(sam2$DNAm[queryHits(overlapArray2)], arrayData$Smoker[subjectHits(overlapArray2)]),3), "; n = ", length(overlapArray2), " sites"))
dev.off()
## cor as a function of read depth
thresholds<-seq(5,100,1)
errorMetrics<-matrix(data = NA, nrow = length(thresholds), ncol = 7)
errorMetrics[,1]<-thresholds
rowNum<-1
for(rdThres in thresholds){
keep<-which(sam2$Coverage[queryHits(overlapArray2)] > rdThres)
r1<-cor(sam2$DNAm[queryHits(overlapArray2)[keep]], arrayData$Smoker[subjectHits(overlapArray2)[keep]])
rmse1<-sqrt(median((sam2$DNAm[queryHits(overlapArray2)[keep]] - arrayData$Smoker[subjectHits(overlapArray2)[keep]])^2))
ncpg1<-length(keep)
keep<-which(sam1$Coverage[queryHits(overlapArray1)] > rdThres)
r2<-cor(sam1$DNAm[queryHits(overlapArray1)[keep]], arrayData$"Non-Smoker"[subjectHits(overlapArray1)[keep]])
rmse2<-sqrt(median((sam1$DNAm[queryHits(overlapArray1)[keep]] - arrayData$"Non-Smoker"[subjectHits(overlapArray1)[keep]])^2))
ncpg2<-length(keep)
errorMetrics[rowNum,2:7]<-c(r1, rmse1, ncpg1, r2, rmse2, ncpg2)
rowNum<-rowNum+1
}
pdf("Plots/LineGraphArrayONTComparisionAgainstReadDepth.pdf", width = 10, height = 5)
par(mfrow = c(1,2))
plot(errorMetrics[,1], errorMetrics[,2], xlab = "RD Threshold", ylab = "r", type = "l", lwd = 2, ylim = c(0.8,1), xlim = c(0,45))
lines(errorMetrics[,1], errorMetrics[,5], lwd = 2)
plot(errorMetrics[,1], errorMetrics[,3], xlab = "RD Threshold", ylab = "RMSE", type = "l", lwd = 2, ylim = c(0,0.18), xlim = c(0,45))
lines(errorMetrics[,1], errorMetrics[,6], lwd = 2)
dev.off()
## as a function of DNAm level
errorMetrics.dnam<-matrix(data = NA, ncol = 7, nrow = 10)
errorMetrics.dnam[,1]<-seq(0.05, 0.95, 0.1)
dnamFilter<-cut(arrayData$Smoker[subjectHits(overlapArray1)], breaks = seq(0,1,0.1))
rowNum<-1
for(each in levels(dnamFilter)){
keep<-which(dnamFilter == each)
r1<-cor(sam2$DNAm[queryHits(overlapArray2)[keep]], arrayData$Smoker[subjectHits(overlapArray2)[keep]])
rmse1<-sqrt(median((sam2$DNAm[queryHits(overlapArray2)[keep]] - arrayData$Smoker[subjectHits(overlapArray2)[keep]])^2))
ncpg1<-length(keep)
errorMetrics.dnam[rowNum,2:4]<-c(r1, rmse1,ncpg1)
rowNum<-rowNum+1
}
dnamFilter<-cut(arrayData$"Non-Smoker"[subjectHits(overlapArray2)], breaks = seq(0,1,0.1))
rowNum<-1
for(each in levels(dnamFilter)){
keep<-which(dnamFilter == each)
r2<-cor(sam1$DNAm[queryHits(overlapArray1)[keep]], arrayData$"Non-Smoker"[subjectHits(overlapArray1)[keep]])
rmse2<-sqrt(median((sam1$DNAm[queryHits(overlapArray1)[keep]] - arrayData$"Non-Smoker"[subjectHits(overlapArray1)[keep]])^2))
ncpg2<-length(keep)
errorMetrics.dnam[rowNum,5:7]<-c(r2, rmse2,ncpg2)
rowNum<-rowNum+1
}
pdf("Plots/LineGraphArrayONTComparisionAgainstDNAmLevel.pdf", width = 10, height = 5)
par(mfrow = c(1,2))
plot(errorMetrics.dnam[,1], errorMetrics.dnam[,2], xlab = "DNAm mean", ylab = "r", type = "l", lwd = 2, ylim = c(0.8,1))
lines(errorMetrics.dnam[,1], errorMetrics.dnam[,5], lwd = 2)
plot(errorMetrics.dnam[,1], errorMetrics.dnam[,3], xlab = "DNAm mean", ylab = "RMSE", type = "l", lwd = 2, ylim = c(0,0.18))
lines(errorMetrics.dnam[,1], errorMetrics.dnam[,6], lwd = 2)
dev.off()
|
Formal statement is: lemma closed_Collect_eq: fixes f g :: "'a::topological_space \<Rightarrow> 'b::t2_space" assumes f: "continuous_on UNIV f" and g: "continuous_on UNIV g" shows "closed {x. f x = g x}" Informal statement is: If $f$ and $g$ are continuous functions from $\mathbb{R}$ to $\mathbb{R}$, then the set $\{x \in \mathbb{R} \mid f(x) = g(x)\}$ is closed.
|
% 19DistributionsaFoliations.tex
% Fund Science! & Help Ernest finish his Physics Research! : quantum super-A-polynomials - a thesis by Ernest Yeung
%
% http://igg.me/at/ernestyalumni2014
%
% Facebook : ernestyalumni
% github : ernestyalumni
% gmail : ernestyalumni
% google : ernestyalumni
% linkedin : ernestyalumni
% tumblr : ernestyalumni
% twitter : ernestyalumni
% youtube : ernestyalumni
% indiegogo : ernestyalumni
%
% Ernest Yeung was supported by Mr. and Mrs. C.W. Yeung, Prof. Robert A. Rosenstone, Michael Drown, Arvid Kingl, Mr. and Mrs. Valerie Cheng, and the Foundation for Polish Sciences, Warsaw University.
%
%These notes are open-source, governed by the Creative Common license. Use of these notes is governed by the Caltech Honor Code: ``No member of the Caltech community shall take unfair advantage of any other member of the Caltech community.'' \\
%
\subsection*{Distributions and Involutivity}
\textbf{distribution on $M$ of rank $k$} is rank-$k$ subbundle of $TM$, \textbf{smooth distribution} if it's smooth subbundle \\
Often rank-$k$ distribution described by specifying $\forall \, p \in M$ linear subspace $D_p \subseteq T_pM$ of $\text{dim}D_p = k$, \\
\phantom{\quad \quad \,} $D = \bigcup_{p \in M} D_p$
Lemma 10.32, local frame criterion for subbundles, that $D$ smooth distribution iff $\forall \, p \in M$, $\exists \, $ open $U \ni p$ on which $\exists \, $ smooth vector fields $X_1 \dots X_k : U \to TM$ s.t. $\left. X_1 \right|_q \dots \left. X_k \right|_q$ is basis for $D_q$ $\forall \, q \in U$
\subsubsection*{Integral Manifolds and Involutivity}
Suppose smooth distribution $D \subseteq TM$ \\
\textbf{integral manifold of $D$} : immersed submanifold $N \neq \emptyset$, $N \subseteq M$ if $T_pN = D_p$ $\forall \, p \in N$
\textbf{Example 19.1 (Distributions and Integral Manifolds)}
\begin{enumerate}
\item[(a)]
\item[(b)]
\item[(c)]
\item[(d)]
\end{enumerate}
$D$ \textbf{involutive} if $\forall \, $ pair of smooth local sections of $D$ (i.e. smooth vector fields $X,Y$ defined on open subset of $M$ s.t. $X_p, Y_p \in D_p$ \, $\forall \, p$) \\
\textbf{integrable} : smooth distribution $D$ on $M$ integrable if $\forall \, p \in M$, $p$ in integral manifold of $D$, i.e. \\
\phantom{\quad \quad \, } $T_p M = D_p$
\begin{proposition}[19.3] $\forall \, $ integrable distribution is involutive. \end{proposition}
\begin{proof} Let $D \subseteq TM$ is integrable distribution. \\
suppose smooth local sections of $D$, $X,Y$ on some open $U\subseteq M$. \\
$\forall \, p \in U$, let $N$ integral manifold of $D$, $N \ni p$ \\
$X,Y$ sections of $D$, so $X,Y$ tangent to $N$ \\
By Corollary 8.32, $[X,Y]$ also tangent to $N$, so $[X,Y]_p \in D_p$
\end{proof}
\subsubsection*{Involutivity and Differential Forms}
\begin{lemma}[19.5] (\textbf{1-form Criterion for Smooth Distributions}) Suppose smooth $n$-dim. manifold $M$, distribution $D \subseteq TM$, rank $k$ \\
$D$ smooth iff $\forall \, p \in M$, $\exists \, $ neighborhood $U$ on which $\exists \, $ smooth 1-forms $\omega^1 \dots \omega^{n-k}$ s.t. $\forall \, q \in U$,
\begin{equation}
D_q = \text{ker} \left. \omega^1 \right|_q \bigcap \dots \bigcap \left. \text{ker} \omega^{n-k} \right|_q \quad \quad \quad \, (19.1)
\end{equation}
\end{lemma}
\begin{proof}
By Prop. 10.15, complete forms $\omega^1 \dots \omega^{n-k}$ to smooth coframe $(\omega^1 \dots \omega^n)$ \quad \, $\forall \, p$ \\
if $(E_1 \dots E_n)$ dual frame, easy to sheet that $D$ locally spanned by $E_{n-k+1 }, \dots , E_n$, so smooth by local frame criterion.
Converse, suppose $D$ smooth. \\
$\forall \, $ open $U \ni p \in M$, $\exists \, $ smooth vector fields $Y_1 \dots Y_k$ spanning $D$. \\
By Prop. 16.5, complete $Y_1 \dots Y_k$ to smooth local frame $(Y_1 \dots Y_n)$ for $M$ in open $U\ni p$ \\
with dual coframe $(\epsilon^1 \dots \epsilon^n)$, it follows easily that $D$ characterized locally by $D_q = \text{ker} \left. \epsilon^{k+1} \right|_q \bigcap \dots \bigcap \text{ker} \left. \epsilon^n \right|_q$
\end{proof}
if $D$ rank-$k$ distribution on smooth $n$-manifold $M$, any \\
\phantom{if $D$ } $n-k$ linearly independent 1-forms $\omega^1 \dots \omega^{n-k}$ on open $U\subseteq M$ s.t. (19.1)
\[
D_q = \left. \text{ker}\omega^1 \right|_q \bigcap \dots \bigcap \left. \text{ker}\omega^{n-k} \right|_q = \lbrace X | X=X^iX_i, \, i =1 \dots k, \, \omega^1(X) = 0\rbrace \bigcap \dots \bigcap \lbrace X | \omega^{n-k}(X) = 0\rbrace
\]
$\forall \, q \in U$ are \textbf{local defining forms} for $D$
\begin{proposition}[19.8] \textbf{(Local Coframe Criterion for Involutivity)}
Let $D$ smooth distribution of rank $k$ on smooth $n$-manifold $M$ \\
let $\omega^1 \dots \omega^{n-k}$ smooth defining forms for $D$ on open $U \subseteq M$.
The following are equivalent:
\begin{enumerate}
\item[(a)] $D$ is involutive on $U$
\item[(b)] $d\omega^1 \dots d\omega^{n-k}$ annihilate $D$
\item[(c)] $\exists \, $ smooth 1-forms $\lbrace \alpha^i_j | i, j =1 \dots n-k \rbrace$ s.t.
\[
d\omega^i = \sum_{j=1}^{n-k} \omega^j \wedge \alpha^i_j \quad \quad \, \forall \, i = 1 \dots n-k
\]
\end{enumerate}
\end{proposition}
\exercisehead{19.9} Prove the preceding proposition, 19.8.
\begin{proof}
(a) $\Longrightarrow$ (b)
On open $U\subseteq M$, $\forall \, q \in U$, $\omega^i$ smooth defining form for $D$, $i=1\dots k$, and $\omega^i(X) = 0$ \, $\forall \, X \in D_q$ \\
\phantom{ On open } Then $d\omega^i$ also annihilates $D$ on $U$ (Thm. 19.7 1-form Criterion for Involutivity (19.3) ) \\
$d\omega^1 \dots d\omega^{n-k}$ annihilate $D$
(b) $\Longrightarrow $ (c)
$d\omega^i \in \Omega^2_q(M)$, $\forall \, q \in U$ \\
By Lemma 19.6, smooth $p$-form $\eta$ on $U$ annihilates $D$ iff $\eta$ ofform $\eta = \sum_{i=1}^{n-k} \omega^i\wedge \beta^i$, for $(p-1)$ forms $\beta^1 \dots \beta^{n-k}$ on $U$ \\
$d\omega^i$ annihilates $D$ \\
\phantom{\quad \, } $\Longrightarrow d\omega^i = \sum_{j=1}^{n-k} \omega^j \wedge \beta_j^i \quad \quad \, \beta^i_{ \, j} $ smooth 1-forms on $U$, $i,j=1\dots n-k$
(c) $\Longrightarrow $ (a)
Use Thm. 19.7 Proof
\[
\omega^i([X,Y]) = X(\omega^i(Y)) - Y(\omega^i(X)) - d\omega^i(X,Y) = 0 -0 - d\omega^i(X,Y)
\]
\[
d\omega^i(X,Y) - \sum_{j=1}^{n-k} \omega^j \wedge \alpha^i_{ \, j}(X,Y) = \sum_{j=1}^{n-k} \omega^j(X) \alpha^i_{ \, j }(Y) - \alpha^i_{ \, j}\omega^j(Y) = 0 - 0 = 0
\]
where I used this local formula:
\[
(\alpha \wedge \beta)_p(v,w) = \alpha_p(v) \beta_p(w) - \alpha_p(w) \beta_p(v)
\]
$\omega^i([X,Y]) = 0$ so $[X,Y] \in \text{ker}\omega^i$ \quad \, $\forall \, i = 1 \dots n-k$
\end{proof}
\subsection*{Problems}
\problemhead{19-3}
Let $\omega \in \Omega^1(M)$ \\
integrating factor $\mu $ for $\omega \equiv \mu \in C^{\infty}(M)$, $\mu > 0$, and $\mu \omega $ exact on $U$, i.e. $\mu \omega = df$, for some $f \in \mathcal{C}^{\infty}(M)$
\begin{enumerate}
\item[(a)] If $\omega \neq 0$ on $U$, \\
Suppose $\omega$ admits an integrating factor $\mu$.
\[
d\omega \wedge \omega = d\left( \frac{df}{\mu} \right) \wedge \frac{df}{\mu} = \left( \frac{d^2 f}{ \mu} + -\frac{df}{\mu^2} \frac{ \partial \mu }{ \partial x^i } dx^i \wedge df \right) \wedge \frac{df}{\mu} = 0
\]
as $d^2f =0$ and $df\wedge df =0$
If $d\omega \wedge \omega =0$, consider $\mu \in \mathcal{C}^{\infty}(M)$ s.t. $\mu >0$ (i.e. positive) on open $U\subseteq M$ (build it up with partitions of unity if need to).
Now, using the formula for exterior differentiation,
\[
d(\mu \omega) = d\mu \wedge \omega + (-1)^0 \mu d\omega
\]
so that
\[
d (\mu \omega) \wedge \omega = d\mu \wedge \omega \wedge \omega + \mu d\omega \wedge \omega = 0 + \mu d\omega \wedge \omega = 0 + 0 = 0
\]
$\omega$ nonzero, so $d(\mu \omega) =0$. EY : 20150221 I'm not sure about this statement. Surely, locally,
\[
d(\mu \omega) \wedge \omega = \frac{1}{2} ( d(\mu \omega) )_{ij} \omega_k dx^i \wedge dx^j \wedge dx^k = d(\mu \omega)_{ \underline{I}} \omega_k dx^{\underline{I}} \wedge dx^k
\]
with $\underline{I} = (i_1,i_2)$ and $i_1 < i_2$.
By considering every $k \neq \underline{I}$, then I think one can conclude, component by component, that $d(\mu \omega) =0$.
Then, consider a compact submanifold $B$, $\text{dim}{B} =3$ that is a submersion of $U$. Then use Stoke's theorem in the following:
\[
\int_B d(\mu \omega) = \int_{\partial B} \mu \omega = 0 \Longrightarrow \mu \omega = df
\]
So
\[
\boxed{ \begin{gathered} \text{ If } \omega \neq 0 \text{ on } U \\
\omega \text{ admits an integrating factor $\mu$ } \text{ iff } d\omega \wedge \omega =0 \end{gathered} }
\]
EY 20150221 : I didn't use Frobenius' theorem for the converse. Should I have?
\item[(b)] If $\text{dim}{M}=2$, $d\omega \wedge \omega =0$ (immediately) \\
Then $\omega $ admits an integrating factor by the above solution.
\end{enumerate}
|
(* Title: Verification components with MKAs
Author: Jonathan Julián Huerta y Munive, 2020
Maintainer: Jonathan Julián Huerta y Munive <[email protected]>
*)
section \<open> Verification components with MKA \<close>
text \<open> We use the forward box operator of antidomain Kleene algebras to derive rules for weakest
liberal preconditions (wlps) of regular programs. \<close>
theory HS_VC_MKA
imports "KAD.Modal_Kleene_Algebra"
begin
subsection \<open> Verification in AKA \<close>
text \<open>Here we derive verification components with weakest liberal preconditions based on
antidomain Kleene algebra \<close>
no_notation Range_Semiring.antirange_semiring_class.ars_r ("r")
and HOL.If ("(if (_)/ then (_)/ else (_))" [0, 0, 10] 10)
notation zero_class.zero ("0")
context antidomain_kleene_algebra
begin
\<comment> \<open> Skip \<close>
lemma "|1] x = d x"
using fbox_one .
\<comment> \<open> Abort \<close>
lemma "|0] q = 1"
using fbox_zero .
\<comment> \<open> Sequential composition \<close>
lemma "|x \<cdot> y] q = |x] |y] q"
using fbox_mult .
declare fbox_mult [simp]
\<comment> \<open> Nondeterministic choice \<close>
lemma "|x + y] q = |x] q \<cdot> |y] q"
using fbox_add2 .
lemma le_fbox_choice_iff: "d p \<le> |x + y]q \<longleftrightarrow> (d p \<le> |x]q) \<and> (d p \<le> |y]q)"
by (metis local.a_closure' local.ads_d_def local.dnsz.dom_glb_eq local.fbox_add2 local.fbox_def)
\<comment> \<open> Conditional statement \<close> (* by Victor Gomes, Georg Struth *)
definition aka_cond :: "'a \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> 'a" ("if _ then _ else _" [64,64,64] 63)
where "if p then x else y = d p \<cdot> x + ad p \<cdot> y"
lemma fbox_export1: "ad p + |x] q = |d p \<cdot> x] q"
using a_d_add_closure addual.ars_r_def fbox_def fbox_mult by auto
lemma fbox_cond [simp]: "|if p then x else y] q = (ad p + |x] q) \<cdot> (d p + |y] q)"
using fbox_export1 local.ans_d_def local.fbox_mult
unfolding aka_cond_def ads_d_def fbox_def by auto
lemma fbox_cond2: "|if p then x else y] q = (d p \<cdot> |x] q) + (ad p \<cdot> |y] q)" (is "?lhs = ?d1 + ?d2")
proof -
have obs: "?lhs = d p \<cdot> ?lhs + ad p \<cdot> ?lhs"
by (metis (no_types, lifting) local.a_closure' local.a_de_morgan fbox_def ans_d_def
ads_d_def local.am2 local.am5_lem local.dka.dsg3 local.dka.dsr5)
have "d p \<cdot> ?lhs = d p \<cdot> |x] q \<cdot> (d p + d ( |y] q))"
using fbox_cond local.a_d_add_closure local.ads_d_def
local.ds.ddual.mult_assoc local.fbox_def by auto
also have "... = d p \<cdot> |x] q"
by (metis local.ads_d_def local.am2 local.dka.dns5 local.ds.ddual.mult_assoc local.fbox_def)
finally have "d p \<cdot> ?lhs = d p \<cdot> |x] q" .
moreover have "ad p \<cdot> ?lhs = ad p \<cdot> |y] q"
by (metis add_commute fbox_cond local.a_closure' local.a_mult_add ads_d_def ans_d_def
local.dnsz.dns5 local.ds.ddual.mult_assoc local.fbox_def)
ultimately show ?thesis
using obs by simp
qed
\<comment> \<open> While loop \<close> (* by Victor Gomes, Georg Struth *)
definition aka_whilei :: "'a \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> 'a" ("while _ do _ inv _" [64,64,64] 63) where
"while t do x inv i = (d t \<cdot> x)\<^sup>\<star> \<cdot> ad t"
lemma fbox_frame: "d p \<cdot> x \<le> x \<cdot> d p \<Longrightarrow> d q \<le> |x] r \<Longrightarrow> d p \<cdot> d q \<le> |x] (d p \<cdot> d r)"
using dual.mult_isol_var fbox_add1 fbox_demodalisation3 fbox_simp by auto
lemma fbox_shunt: "d p \<cdot> d q \<le> |x] t \<longleftrightarrow> d p \<le> ad q + |x] t"
by (metis a_6 a_antitone' a_loc add_commute addual.ars_r_def am_d_def da_shunt2 fbox_def)
lemma fbox_export2: "|x] p \<le> |x \<cdot> ad q] (d p \<cdot> ad q)"
proof -
{fix t
have "d t \<cdot> x \<le> x \<cdot> d p \<Longrightarrow> d t \<cdot> x \<cdot> ad q \<le> x \<cdot> ad q \<cdot> d p \<cdot> ad q"
by (metis (full_types) a_comm_var a_mult_idem ads_d_def am2 ds.ddual.mult_assoc phl_export2)
hence "d t \<le> |x] p \<Longrightarrow> d t \<le> |x \<cdot> ad q] (d p \<cdot> ad q)"
by (metis a_closure' addual.ars_r_def ans_d_def dka.dsg3 ds.ddual.mult_assoc fbox_def fbox_demodalisation3)}
thus ?thesis
by (metis a_closure' addual.ars_r_def ans_d_def fbox_def order_refl)
qed
lemma fbox_while: "d p \<cdot> d t \<le> |x] p \<Longrightarrow> d p \<le> |(d t \<cdot> x)\<^sup>\<star> \<cdot> ad t] (d p \<cdot> ad t)"
proof -
assume "d p \<cdot> d t \<le> |x] p"
hence "d p \<le> |d t \<cdot> x] p"
by (simp add: fbox_export1 fbox_shunt)
hence "d p \<le> |(d t \<cdot> x)\<^sup>\<star>] p"
by (simp add: fbox_star_induct_var)
thus ?thesis
using order_trans fbox_export2 by presburger
qed
lemma fbox_whilei:
assumes "d p \<le> d i" and "d i \<cdot> ad t \<le> d q" and "d i \<cdot> d t \<le> |x] i"
shows "d p \<le> |while t do x inv i] q"
proof-
have "d i \<le> |(d t \<cdot> x)\<^sup>\<star> \<cdot> ad t] (d i \<cdot> ad t)"
using fbox_while assms by blast
also have "... \<le> |(d t \<cdot> x)\<^sup>\<star> \<cdot> ad t] q"
by (metis assms(2) local.dka.dom_iso local.dka.domain_invol local.fbox_iso)
finally show ?thesis
unfolding aka_whilei_def
using assms(1) local.dual_order.trans by blast
qed
lemma fbox_seq_var: "p \<le> |x] p' \<Longrightarrow> p' \<le> |y] q \<Longrightarrow> p \<le> |x \<cdot> y] q"
proof -
assume h1: "p \<le> |x] p'" and h2: "p' \<le> |y] q"
hence "|x] p' \<le> |x] |y] q"
by (metis ads_d_def fbox_antitone_var fbox_dom fbox_iso)
thus ?thesis
by (metis dual_order.trans fbox_mult h1)
qed
lemma fbox_whilei_break:
"d p \<le> |y] i \<Longrightarrow> d i \<cdot> ad t \<le> d q \<Longrightarrow> d i \<cdot> d t \<le> |x] i \<Longrightarrow> d p \<le> |y \<cdot> (while t do x inv i)] q"
apply (rule fbox_seq_var[OF _ fbox_whilei])
using fbox_simp by auto
\<comment> \<open> Finite iteration \<close>
definition aka_loopi :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" ("loop _ inv _ " [64,64] 63)
where "loop x inv i = x\<^sup>\<star>"
lemma "d p \<le> |x] p \<Longrightarrow> d p \<le> |x\<^sup>\<star>] p"
using fbox_star_induct_var .
lemma fbox_loopi: "p \<le> d i \<Longrightarrow> d i \<le> |x] i \<Longrightarrow> d i \<le> d q \<Longrightarrow> p \<le> |loop x inv i] q"
unfolding aka_loopi_def by (meson dual_order.trans fbox_iso fbox_star_induct_var)
lemma fbox_loopi_break:
"p \<le> |y] d i \<Longrightarrow> d i \<le> |x] i \<Longrightarrow> d i \<le> d q \<Longrightarrow> p \<le> |y \<cdot> (loop x inv i)] q"
by (rule fbox_seq_var, force) (rule fbox_loopi, auto)
\<comment> \<open> Invariants \<close>
lemma "p \<le> i \<Longrightarrow> i \<le> |x]i \<Longrightarrow> i \<le> q \<Longrightarrow> p \<le> |x]q"
by (metis local.ads_d_def local.dpdz.dom_iso local.dual_order.trans local.fbox_iso)
lemma "p \<le> d i \<Longrightarrow> d i \<le> |x]i \<Longrightarrow> i \<le> d q \<Longrightarrow> p \<le> |x]q"
by (metis local.a_4 local.a_antitone' local.a_subid_aux2 ads_d_def order.antisym fbox_def
local.dka.dsg1 local.dual.mult_isol_var local.dual_order.trans local.order.refl)
lemma "(i \<le> |x] i) \<or> (j \<le> |x] j) \<Longrightarrow> (i + j) \<le> |x] (i + j)"
(*nitpick*)
oops
lemma "d i \<le> |x] i \<Longrightarrow> d j \<le> |x] j \<Longrightarrow> (d i + d j) \<le> |x] (d i + d j)"
by (metis (no_types, lifting) dual_order.trans fbox_simp fbox_subdist join.le_supE join.le_supI)
lemma plus_inv: "i \<le> |x] i \<Longrightarrow> j \<le> |x] j \<Longrightarrow> (i + j) \<le> |x] (i + j)"
by (metis ads_d_def dka.dsr5 fbox_simp fbox_subdist join.sup_mono order_trans)
lemma mult_inv: "d i \<le> |x] i \<Longrightarrow> d j \<le> |x] j \<Longrightarrow> (d i \<cdot> d j) \<le> |x] (d i \<cdot> d j)"
using fbox_demodalisation3 fbox_frame fbox_simp by auto
end
end
|
% BEGIN LICENSE BLOCK
% Version: CMPL 1.1
%
% The contents of this file are subject to the Cisco-style Mozilla Public
% License Version 1.1 (the "License"); you may not use this file except
% in compliance with the License. You may obtain a copy of the License
% at www.eclipse-clp.org/license.
%
% Software distributed under the License is distributed on an "AS IS"
% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
% the License for the specific language governing rights and limitations
% under the License.
%
% The Original Code is The ECLiPSe Constraint Logic Programming System.
% The Initial Developer of the Original Code is Cisco Systems, Inc.
% Portions created by the Initial Developer are
% Copyright (C) 2006 Cisco Systems, Inc. All Rights Reserved.
%
% Contributor(s):
%
% END LICENSE BLOCK
% File : multiuser-sec.tex
% Date : March 1992
% Author : Michael Dahmen
% Modified by : Luis Hermosilla, August 1992
% Joachim Schimpf, July 1994
% Project : MegaLog-Sepia User Manual
% Content : The multi user system, recovery, transactions
\newpage
\chapter{Multi User \eclipse}
\label{multi}
\index{multi user}
\index{transaction}
The \eclipse multi user system allows to share databases or
knowledge bases among several users. Every user is running an \eclipse
process and is able to retrieve and update information.
To the user, multi user database access is similar to single user
access described in the previous chapters except that any
access of shared relations must be performed within a {\em transaction} context.
This guarantees that the database is kept in a consistent
state at all times.
Multi User \eclipse is designed for client-server networks.
A database server process manages the database, and the \eclipse client
processes communicate with the server, possibly across a network.
The standard \eclipse configuration allows up to 32 concurrent user
processes per database. This restriction may be lifted in future releases.
\section{The Database server}
Any database can be used in either single or multi user mode:
\begin{itemize}
\item In single user mode, a single \eclipse process opens the database
exclusively, preventing other users from using it at the same time.
\item In multi user mode, a database server process manages the
database and several \eclipse client processes can use the database
concurrently via this server.
\end{itemize}
The multi user mode is enabled for a database by simply starting
a database server for it. A server is started with the command
\begin{quote}\begin{verbatim}
% bang_server /data/base/path &
\end{verbatim}\end{quote}
where the argument specifies the database that the server should control.
The server should be started as background process, which is achieved
by the \verb+&+ suffix.
The server must be started before the first user process tries to
open the database (otherwise the first user process would open it
in single user mode).
When there is already a server running, or when the database is
already open in single user mode, an attempt to start a server
results in an error.
The database server may be terminated by the following command
\begin{quote}\begin{verbatim}
% kill -INT pid
\end{verbatim}\end{quote}
where {\tt pid} is the process identification
number of the database server process.
\section{Accessing a Multi User Database}
After invoking the \eclipse process the user opens a database or
knowledge base as usual, by just specifying the database path name.
The system will check whether the database is controlled
by a database server. If so, it will connect to the server and
switch to multi user mode, otherwise the database is opened in single
user mode.
After opening the shared database a user has access to all permanent
relations, as they are all shared. The temporary relations are private
per user and invisible to other users. Access to both types of relation
is provided by the interface described in chapter \ref{database-sec} and
\ref{knowbase-sec}. However, any access to shared relations is only
possible within a transaction context.
If a database access is made outside a transaction context
an error is raised.
\index{transaction}
\index{shared relation}
A transaction context is established as follows:
\begin{quote}\begin{verbatim}
?- transaction(Goal).
\end{verbatim}\end{quote}
which executes {\bf Goal} as a transaction. Any changes the execution of
the goal makes to the database are only {\em committed} (i.e.
made permanent) if the goal succeeds. This
gives a transaction an all-or-nothing property,
with either all the updates of the goal being committed to the database for
a valid goal, or the database being left in
the old state (i.e. as before the transaction started)
for an invalid goal. An example:
\begin{quote}\begin{verbatim}
?- openkb(test).
yes
?- transaction(( flight <==> S1, passenger <==> S2 )).
S1 = [+flight_no, +from, +to, time, day].
S2 = [+name, +flight_no].
yes
?- transaction(
insert_clause(flight(ba100,london,munich,1200,tuesday))
).
yes
?- read(Name), read(Flight), % should not be done inside transactions
transaction( (insert_clause( passenger(Name,Flight) ),
flight(Flight, From, To, Time, Day),
% assuming flight is transparent
write('From: '), writeln(From),
write('To: '), writeln(To),
write('Time: '), writeln(Day),
write('Day: '), writeln(Time),
write('Confirm (y/n): '),
read(Conf),
Conf == y) ).
smith.
ba100.
From: london
To: munich
Time: tuesday
Day: 1200
Confirm (y/n):
\end{verbatim}\end{quote}
This example takes a passenger's name (smith) and flight request
(ba100) and prints the flight details. If the request is confirmed
the passenger name and flight is added to the passenger relation.
The addition to the database required by the sub-goal
\begin{quote}\begin{verbatim}
insert_clause( passenger(Name,Flight) )
\end{verbatim}\end{quote}
will only be committed if 'y.' is entered to confirm the flight booking.
Otherwise the final sub-goal fails and no database changes are made.
Note that it is not possible to modify the shared part of the database
schema while using a database in the multi user mode. This restriction
might be lifted in future releases.
\section{Concurrency Control}
\index{concurrency}
\eclipse uses the {\em Two Phase Locking} algorithm to control
concurrent usage of the database.
\index{two phase locking}
Two phase locking uses read and write locks on
all permanent relations. Before a read or write
operation is performed within a transaction the
corresponding lock is obtained. This is done during
the first phase of the transaction. The second phase consists
of only two operations, namely committing or undoing the
changes and releasing all obtained locks. Several transactions
can have a read lock on a single item, but if a transaction
has a write lock no other can have any lock on it at the
same time. When a transaction is unable to
obtain a lock it is suspended until the lock comes free,
and then it is continued.
This strategy guarantees serialisability i.e.\
the result of the interleaved execution is equivalent
to a sequential execution of non-interleaved transactions.
Concurrency control is performed automatically behind
the scenes and there is neither a need nor a possibility for the user
to influence it. Only the lock granularity can be changed by the
user between relation level and page level locking (see Knowledge Base BIP
Book, {\bf database_parameter/2}).
\section{Deadlock Detection and Handling}
\index{deadlock}
Since a transaction is suspended when a lock cannot
be obtained there is the chance of a {\em deadlock}.
A deadlock is a situation where a set of transactions is
suspended, each waiting for an item locked by another member
of the set. A deadlock can only be resolved by aborting at
least one of the transactions.
The transaction that is aborted when deadlock occurs is called
the victim. The strategy for victim selection must prevent
lifelock. A lifelock happens when the victim is restarted and
leads to the same deadlock as before. A lifelock is prevented in
\eclipse by always aborting the youngest transaction, and by
fairness of lock distribution (i.e. on a first-come first-served
basis).
When a transaction is aborted due to deadlock an error is raised
and the error handler executes the goal
\begin{quote}\begin{verbatim}
?- exit_block(transaction_abort).
\end{verbatim}\end{quote}
This {\em exit\_block/1} operation aborts the transaction and restarts it.
A transaction is restarted up to 10 times. If it is chosen as victim
10 times another is raised and no further attempt to restart is made.
Before the transaction is restarted all changes done to shared relations
are undone. However, changes to private relations or the Prolog
main memory (e.g. dynamic database, global variable and arrays) are not
undone. Programs that are executed as transactions must therefore be
written in such a way that they can cope with restarts.
One way to achieve this is to trap the {\em exit\_block/1} operation with
{\em block/3} construct. Another possibility is to remove all temporary
relations at the start of any transaction.
A simple example how to use the {\em block/3} construct is given below.
Let us assume \verb+s1+ and \verb+s2+ are shared relations and \verb+p+
a private, all with a single attribute of type atom.
\begin{quote}\begin{verbatim}
unsafe(X) :- ins_tup(s1,X), ins_tup(p,X), ins_tup(s2,X).
?- transaction(unsafe(new_item)).
\end{verbatim}\end{quote}
Such a program is unsafe with respect to transaction abort in the case
of deadlocks. Let us assume that a deadlock occurs when an attempt is
made to insert into \verb+s2+ and that this transaction is selected as
victim. The change done to \verb+s1+ will be undone, but the change
of \verb+p+ will not, because it is part of the private database.
A safe version using {\em block/3} looks as follows.
\begin{quote}\begin{verbatim}
safe(X) :- ins_tup(s1,X),
block(ins_tup(p,X),
Tag,
( del_tup(p,X), exit_block(Tag) )),
ins_tup(s2,X).
?- transaction(safe(new_item)).
\end{verbatim}\end{quote}
If the same deadlock occurs in this transaction the tuple inserted will
be deleted before the transaction restarts. It is important that
the {\em block/3} does invoke the {\em exit\_block/1} afterwards,
otherwise the transaction will not be restarted.
Please note that the example above simplifies the problem, e.g. it
does not handle the case that the insertion was not effective because
the tuple is already stored. In general it is simpler to
initialise the private relations at the start of the transaction,
the method sketched aboved should only used where that approach
is not possible for other reasons.
\section{Recovery}
The capability to undo transactions requires a recovery mechanism.
The \eclipse recovery algorithm does also handle recovery after
a system failure
\footnote{A `system failure' is when there is a hardware or software
failure that requires a process(es) to be restarted, but does not affect secondary storage.}.
If system failure occurs while \eclipse is executing transactions a
{\em consistent recovery} is guaranteed. This means that after such
a failure the database will be left in a consistent state,
with any changes made by aborted or incomplete transactions being undone.
A {\em shadow page} technique is used by \eclipse to implement the
recovery procedure.
\index{recovery}
Recovery only applies to permanent relations and not temporary ones.
This is because temporary relations are conceptually intended to last
for just the life of the transaction in which they are produced, and
therefore recovery is unnecessary. In actual fact temporary relations
continue to exist until the end of the owner's \eclipse session.
This provides a useful way of passing sets of tuples or clauses
outside a transaction.
Recovery after a system failure is also provided in single user \eclipse.
The {\em transaction/1} predicate does exist in all variants and
defines the unit of recovery.
Note that recovery from system failure is only guaranteed to work if
the operating system supports acknowledge disk writes and the
controlling \eclipse parameter is turned on (see Knowledge Base BIP Book,
{\bf database_parameter/2}).
\section{Old \& New States}
During a transaction a permanent relation has two states.
The old state is the state of the relation before the transaction starts
and the new state is the state of the relation
after all the changes of previous subgoals have been made.
Within a transaction the new
state is always used (unless the old state is explicitly selected), and when
the transaction completes successfully the changes are
committed and the old state becomes equal to the new state.
To obtain the old state within a transaction the operator {\bf old} is
used in the following way:
\index{old/1}
\begin{quote}\begin{verbatim}
old(RelationName)
\end{verbatim}\end{quote}
where {\bf RelationName} is the name of a relation.
Therefore a predicate can be directed to work with the
old state of a relation by adding the old operator
to the relation's name. An example is
\begin{quote}\begin{verbatim}
1 ?- transaction( digits <++ [ 1,2,3,4,5 ] ).
yes
2 ?- transaction( ( ins_tup( digits(6) ),
findall(X,retr_tup( old(digits), X), L))).
L = [[1], [2], [3], [4], [5]]
X = _g16
yes
3 ?- transaction( findall(X,retr_tup(digits,X),L) ).
L = [[1], [2], [3], [4], [5], [6]]
X = _g4
yes
\end{verbatim}\end{quote}
The second transaction inserts a tuple into the digits relation,
and then generates a list of all the tuples in that relation.
Since the {\bf retr\_tup} predicate is directed to work with the old
state the newly added tuple does not appear in the list.
Even though the new state of a predicate is used by default a
new operator is included for completeness i.e.
\index{new/1}
\begin{quote}\begin{verbatim}
new(RelationName)
\end{verbatim}\end{quote}
The old state exists both in the DB and the KB version, however, in
the KB version access is a bit tricky. An expression like
\begin{quote}\begin{verbatim}
retrieve_clause(( (old(name))(Arg1, Arg2) :- Body ))
\end{verbatim}\end{quote}
is {\em not} legal Prolog. One must therefore first introduce a synonym
\begin{quote}\begin{verbatim}
old(name) <--> old_name
retrieve_clause(( old_name(Arg1, Arg2) :- Body ))
\end{verbatim}\end{quote}
\section{Deterministic Transactions}
Since a transaction must release all its locks on completion
it cannot backtrack. Therefore {\bf transaction/1} will
succeed at most once (i.e. it is deterministic).
This does not limit the use of the transaction primitive
as the {\bf findall} predicate can be used to collect
sets of solutions (see previous example).
Also temporary relations can be used. As mentioned
above these conceptually die when their transaction dies,
but since it is a useful way of passing sets of clauses
from a transaction (which can then be used for backtracking
{\em outside} a transaction) they are allowed to live until
the end of the session.
|
%% ODF Estimation from EBSD data
%
%%
% In order to discuss ODF estimation from individual orientation data we
% start by loading an EBSD data set
mtexdata copper
plot(ebsd,ebsd.orientations)
%%
% of copper. The orientation distribution function can now be computed by
odf = calcDensity(ebsd('copper').orientations)
plotSection(odf,'contourf')
mtexColorMap LaboTeX
mtexColorbar
%%
% The function <orientation.calcODF.html calcODF> implements the ODF
% estimation from EBSD data in MTEX. The underlying statistical method is
% called kernel density estimation, which can be seen as a generalized
% histogram. To be more precise, let's $\psi : SO(3) \to R$ be a radially
% symmetric, unimodal model ODF. Then the kernel density estimator for the
% individual orientation data $o_1,o_2,\ldots,o_M$ is defined as
%
% $$f(o) = \frac{1}{M} \sum_{i=1}^{M} \psi(o o_i^{-1})$$
%
% The choice of the model ODF $\psi$ and in particular its halfwidth has a
% great impact in the resulting ODF. If no halfwidth is specified the
% default halfwidth of 10 degrees is selected.
%
%% Automatic halfwidth selection
%
% MTEX includes an automatic halfwidth selection algorithm which is called
% by the command <orientation.calcKernel.html calcKernel>. To work
% properly, this algorithm needs spatially independent EBSD data as in the
% case of this dataset of very rough EBSD measurements (only one
% measurement per grain).
% try to compute an optimal kernel
psi = calcKernel(ebsd.orientations)
%%
% In the above example, the EBSD measurements are spatial dependent and the
% resulting halfwidth is too small. To avoid this problem we have to perform
% grain reconstruction first and then estimate the halfwidth from the
% grains.
% grains reconstruction
grains = calcGrains(ebsd);
% correct for to small grains
grains = grains(grains.grainSize>5);
% compute optimal halfwidth from the meanorientations of grains
psi = calcKernel(grains('co').meanOrientation)
% compute the ODF with the kernel psi
odf = calcDensity(ebsd('co').orientations,'kernel',psi)
%%
% Once an ODF is estimated all the functionality MTEX offers for
% <ODFCharacteristics.html ODF analysis> and <ODFPlot.html ODF
% visualization> is available.
h = [Miller(1,0,0,odf.CS),Miller(1,1,0,odf.CS),Miller(1,1,1,odf.CS)];
plotPDF(odf,h,'antipodal','silent')
%% Effect of halfwidth selection
%
% As mentioned above a proper halfwidth selection is crucial for ODF
% estimation. The following simple numerical experiment illustrates the
% dependency between the kernel halfwidth and the estimated error.
%
% Let's start with a model ODF and simulate some individual orientation data.
modelODF = fibreODF(Miller(1,1,1,crystalSymmetry('cubic')),xvector);
ori = discreteSample(modelODF,10000)
%%
% Next we define a list of kernel halfwidth ,
hw = [1*degree, 2*degree, 4*degree, 8*degree, 16*degree, 32*degree];
%%
% estimate for each halfwidth an ODF and compare it to the original ODF.
e = zeros(size(hw));
for i = 1:length(hw)
odf = calcDensity(ori,'halfwidth',hw(i),'silent');
e(i) = calcError(modelODF, odf);
end
%%
% After visualizing the estimation error we observe that its value is large
% either if we choose a very small or a very large halfwidth.
% In this specific example, the optimal halfwidth seems to be about 4
% degrees.
close all
plot(hw/degree,e)
xlabel('halfwidth in degree')
ylabel('esimation error')
|
/**
* @file beamformer.h
* @brief Beamforming in the subband domain.
* @author John McDonough and Kenichi Kumatani
*/
#ifndef BEAMFORMER_H
#define BEAMFORMER_H
#include <stdio.h>
#include <assert.h>
#include <float.h>
#include <gsl/gsl_block.h>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_complex.h>
#include <gsl/gsl_complex_math.h>
#include <gsl/gsl_fft_complex.h>
#include <common/refcount.h>
#include "common/jexception.h"
#include "stream/stream.h"
#include "beamformer/spectralinfoarray.h"
#include "modulated/modulated.h"
#define SSPEED 343740.0
class BeamformerWeights {
public:
BeamformerWeights( unsigned fftLen, unsigned chanN, bool halfBandShift, unsigned NC = 1 );
~BeamformerWeights();
void calcMainlobe( float samplerate, const gsl_vector* delays, bool isGSC );
void calcMainlobe2( float samplerate, const gsl_vector* delaysT, const gsl_vector* delaysJ, bool isGSC );
void calcMainlobeN( float samplerate, const gsl_vector* delaysT, const gsl_matrix* delaysIs, unsigned NC, bool isGSC );
void calcSidelobeCancellerP_f( unsigned fbinX, const gsl_vector* packedWeight );
void calcSidelobeCancellerU_f( unsigned fbinX, const gsl_vector_complex* wa );
void calcBlockingMatrix( unsigned fbinX );
bool write_fir_coeff(const String& fn, unsigned winType);
#ifdef ENABLE_LEGACY_BTK_API
bool writeFIRCoeff(const String& fn, unsigned winType);
#endif
void setSidelobeCanceller_f( unsigned fbinX, gsl_vector_complex* wl_f ){
gsl_vector_complex_memcpy( wl_[fbinX], wl_f );
}
void setQuiescentVector( unsigned fbinX, gsl_vector_complex *wq_f, bool isGSC=false );
void setQuiescentVectorAll( gsl_complex z, bool isGSC=false );
void setTimeAlignment();
bool isHalfBandShift() const {return(halfBandShift_);}
unsigned NC() const {return(NC_);}
unsigned fftLen() const {return(fftLen_);}
unsigned chanN() const {return(chanN_);}
gsl_vector_complex** arrayManifold() const { return (ta_); }
gsl_vector_complex* wq_f( unsigned fbinX ) const { return wq_[fbinX]; }
gsl_vector_complex* wl_f( unsigned fbinX ) const { return wl_[fbinX]; }
gsl_vector_complex** wq() const { return (wq_); }
gsl_matrix_complex** B() const { return (B_); }
gsl_vector_complex** wa() const { return (wa_); }
gsl_vector_complex** CSDs() const { return CSDs_; }
gsl_vector_complex* wp1() const { return wp1_; }
private:
void alloc_weights_();
void free_weights_();
unsigned fftLen_;
unsigned chanN_;
bool halfBandShift_;
unsigned NC_; // the numbef of constraints
gsl_vector_complex** wq_; // a quiescent weight vector for each frequency bin, wq_[fbinX][chanN]
gsl_matrix_complex** B_; // a blocking matrix for each frequency bin, B_[fbinX][chanN][chanN-NC]
gsl_vector_complex** wa_; // an active weight vector for each frequency bin, wa_[fbinX][chanN-NC]
gsl_vector_complex** wl_; // wl_[fbinX] = B_[fbinX] * wa_[fbinX]
gsl_vector_complex** ta_; // do time alignment for multi-channel waves. It is also called an array manifold. _ta[fbinX][chanN].
gsl_vector_complex* wp1_; // a weight vector of postfiltering, _wp[fbinX]
gsl_vector_complex** CSDs_; // cross spectral density for the post-filtering
};
typedef refcount_ptr<BeamformerWeights> BeamformerWeightsPtr;
// ----- definition for class `SubbandBeamformer' -----
//
class SubbandBeamformer : public VectorComplexFeatureStream {
public:
SubbandBeamformer(unsigned fftLen = 512, bool halfBandShift = false, const String& nm = "SubbandBeamformer");
~SubbandBeamformer();
virtual const gsl_vector_complex* next(int frame_no = -5);
virtual void reset();
unsigned fftLen() const { return fftLen_; }
unsigned fftLen2() const { return fftLen2_; }
unsigned chanN() const { return channelList_.size(); }
virtual unsigned dim() const { return chanN();}
bool is_end() const {return is_end_;}
const gsl_vector_complex* snapshot_array_f(unsigned fbinX) const { return (snapshot_array_->snapshot(fbinX)); }
virtual SnapShotArrayPtr snapshot_array() const { return(snapshot_array_); }
void set_channel(VectorComplexFeatureStreamPtr& chan);
virtual void clear_channel();
#ifdef ENABLE_LEGACY_BTK_API
bool isEnd() { return is_end(); }
const gsl_vector_complex* snapShotArray_f(unsigned fbinX){ return snapshot_array_f(fbinX); }
virtual SnapShotArrayPtr getSnapShotArray(){ return(snapshot_array()); }
void setChannel(VectorComplexFeatureStreamPtr& chan){ set_channel(chan); }
virtual void clearChannel(){ clear_channel(); }
#endif
protected:
typedef list<VectorComplexFeatureStreamPtr> ChannelList_;
typedef ChannelList_::iterator ChannelIterator_;
SnapShotArrayPtr snapshot_array_;
unsigned fftLen_;
unsigned fftLen2_;
bool halfBandShift_;
ChannelList_ channelList_;
};
// ----- definition for class `SubbandDS' -----
//
class SubbandDS : public SubbandBeamformer {
public:
SubbandDS(unsigned fftLen = 512, bool halfBandShift = false, const String& nm = "SubbandDS");
~SubbandDS();
virtual const gsl_vector_complex* next(int frame_no = -5);
virtual void reset();
virtual void clear_channel();
virtual const gsl_vector_complex *get_weights(unsigned fbinX) const { return bfweight_vec_[0]->wq_f(fbinX); }
virtual BeamformerWeights* beamformer_weight_object(unsigned srcX=0) const { return bfweight_vec_[srcX]; }
virtual void calc_array_manifold_vectors(float samplerate, const gsl_vector* delays);
virtual void calc_array_manifold_vectors_2(float samplerate, const gsl_vector* delaysT, const gsl_vector* delaysJ);
virtual void calc_array_manifold_vectors_n(float samplerate, const gsl_vector* delaysT, const gsl_matrix* delaysJ, unsigned NC=2);
#ifdef ENABLE_LEGACY_BTK_API
virtual void clearChannel(){ clear_channel(); }
virtual const gsl_vector_complex *getWeights(unsigned fbinX) const { return get_weights(fbinX); }
virtual BeamformerWeights* getBeamformerWeightObject(unsigned srcX=0) const { return beamformer_weight_object(srcX); }
virtual void calcArrayManifoldVectors(float sampleRate, const gsl_vector* delays){
calc_array_manifold_vectors(sampleRate, delays);
}
virtual void calcArrayManifoldVectors2(float sampleRate, const gsl_vector* delaysT, const gsl_vector* delaysJ){
calc_array_manifold_vectors_2(sampleRate, delaysT, delaysJ);
}
virtual void calcArrayManifoldVectorsN(float sampleRate, const gsl_vector* delaysT, const gsl_matrix* delaysJ, unsigned NC=2){
calc_array_manifold_vectors_n(sampleRate, delaysT, delaysJ, NC);
}
#endif /* #ifdef ENABLE_LEGACY_BTK_API */
protected:
void alloc_image_();
void alloc_bfweight_(int nSrc, int NC);
vector<BeamformerWeights *> bfweight_vec_; // weights of a beamformer per source.
};
#define NO_PROCESSING 0x00
#define SCALING_MDP 0x01
class SubbandGSC : public SubbandDS {
public:
SubbandGSC(unsigned fftLen = 512, bool halfBandShift = false, const String& nm = "SubbandGSC")
: SubbandDS( fftLen, halfBandShift, nm ),normalize_weight_(false){}
~SubbandGSC();
virtual const gsl_vector_complex* next(int frame_no = -5);
void normalize_weight(bool flag){ normalize_weight_ = flag; }
void set_quiescent_weights_f(unsigned fbinX, const gsl_vector_complex* srcWq);
void set_active_weights_f(unsigned fbinX, const gsl_vector* packedWeight);
void zero_active_weights();
void calc_gsc_weights(float samplerate, const gsl_vector* delaysT);
void calc_gsc_weights_2(float samplerate, const gsl_vector* delaysT, const gsl_vector* delaysJ);
void calc_gsc_weights_n(float samplerate, const gsl_vector* delaysT, const gsl_matrix* delaysJ, unsigned NC=2);
bool write_fir_coeff(const String& fn, unsigned winType=1);
gsl_matrix_complex* blocking_matrix(unsigned srcX, unsigned fbinX){
return (bfweight_vec_[srcX]->B())[fbinX];
}
#ifdef ENABLE_LEGACY_BTK_API
void normalizeWeight(bool flag){ normalize_weight(flag); }
void setQuiescentWeights_f(unsigned fbinX, const gsl_vector_complex * srcWq){ set_quiescent_weights_f(fbinX, srcWq); }
void setActiveWeights_f(unsigned fbinX, const gsl_vector* packedWeight){ set_active_weights_f(fbinX, packedWeight); }
void zeroActiveWeights(){ zero_active_weights(); }
void calcGSCWeights(float sampleRate, const gsl_vector* delaysT){ calc_gsc_weights(sampleRate, delaysT); }
void calcGSCWeights2(float sampleRate, const gsl_vector* delaysT, const gsl_vector* delaysJ){ calc_gsc_weights_2(sampleRate, delaysT, delaysJ); }
void calcGSCWeightsN(float sampleRate, const gsl_vector* delaysT, const gsl_matrix* delaysJ, unsigned NC=2){ calc_gsc_weights_n(sampleRate, delaysT, delaysJ, NC); }
bool writeFIRCoeff(const String& fn, unsigned winType=1){ return write_fir_coeff(fn, winType); }
gsl_matrix_complex* getBlockingMatrix(unsigned srcX, unsigned fbinX){ return blocking_matrix(srcX, fbinX); }
#endif /* #ifdef ENABLE_LEGACY_BTK_API */
protected:
bool normalize_weight_;
};
/**
@class SubbandGSCRLS
@brief implementation of recursive least squares of a GSC
@usage
1. calcGSCWeights()
2. initPrecisionMatrix() or setPrecisionMatrix()
3. update_sctive_weight_vecotrs( false ) if you want to stop adapting the active weight vectors.
@note notations are based on Van Trees, "Optimum Array Processing", pp. 766-767.
*/
typedef enum {
CONSTANT_NORM = 0x01,
THRESHOLD_LIMITATION = 0x02,
NO_QUADRATIC_CONSTRAINT = 0x00
} QuadraticConstraintType;
// ----- definition for class `SubbandGSCRLS' -----
//
class SubbandGSCRLS : public SubbandGSC {
public:
SubbandGSCRLS(unsigned fftLen = 512, bool halfBandShift = false, float mu = 0.9, float sigma2=0.0, const String& nm = "SubbandGSCRLS");
~SubbandGSCRLS();
virtual const gsl_vector_complex* next(int frame_no = -5);
virtual void reset();
void init_precision_matrix(float sigma2 = 0.01);
void set_precision_matrix(unsigned fbinX, gsl_matrix_complex *Pz);
void update_active_weight_vecotrs(bool flag){ is_wa_updated_ = flag; }
void set_quadratic_constraint(float alpha, int qctype=1){ alpha_=alpha; qctype_=(QuadraticConstraintType)qctype; }
#ifdef ENABLE_LEGACY_BTK_API
void initPrecisionMatrix(float sigma2 = 0.01){ init_precision_matrix(sigma2); }
void setPrecisionMatrix(unsigned fbinX, gsl_matrix_complex *Pz){ set_precision_matrix(fbinX, Pz); }
void updateActiveWeightVecotrs(bool flag){ update_active_weight_vecotrs(flag); }
void setQuadraticConstraint(float alpha, int qctype=1){ set_quadratic_constraint(alpha, qctype); }
#endif /* #ifdef ENABLE_LEGACY_BTK_API */
private:
void update_active_weight_vector2_(int frame_no); /* the case of the half band shift = False */
bool alloc_subbandGSCRLS_image_();
void free_subbandGSCRLS_image_();
gsl_vector_complex** gz_; /* Gain vectors */
gsl_matrix_complex** Pz_; /* Precision matrices */
gsl_vector_complex* Zf_; /* output of the blocking matrix at each frequency */
gsl_vector_complex* wa_;
float mu_; /* Exponential factor for the covariance matrix */
float* diagonal_weights_;
float alpha_; /* Weight for the quadratic constraint*/
QuadraticConstraintType qctype_;
bool is_wa_updated_;
/* work space for updating active weight vectors */
gsl_vector_complex* PzH_Z_;
gsl_matrix_complex* _I;
gsl_matrix_complex* mat1_;
};
// ----- definition for class `SubbandMMI' -----
//
class SubbandMMI : public SubbandDS {
public:
SubbandMMI(unsigned fftLen = 512, bool halfBandShift = false, unsigned targetSourceX=0, unsigned nSource=2, int pfType=0, float alpha=0.9, const String& nm = "SubbandMMI")
: SubbandDS( fftLen, halfBandShift, nm ),
targetSourceX_(targetSourceX),
nSource_(nSource),
pftype_(pfType),
alpha_(alpha),
use_binary_mask_(false),
binary_mask_type_(0),
interference_outputs_(NULL),
avg_output_(NULL)
{}
~SubbandMMI();
virtual const gsl_vector_complex* next(int frame_no = -5);
void use_binary_mask(float avgFactor=-1.0, unsigned fwidth=1, unsigned type=0);
void calc_weights( float samplerate, const gsl_matrix* delays);
void calc_weights_n( float samplerate, const gsl_matrix* delays, unsigned NC=2);
void set_hi_active_weights_f(unsigned fbinX, const gsl_vector* pkdWa, const gsl_vector* pkdwb, int option=0);
void set_active_weights_f(unsigned fbinX, const gsl_matrix* packedWeights, int option=0);
#ifdef ENABLE_LEGACY_BTK_API
void useBinaryMask(float avgFactor=-1.0, unsigned fwidth=1, unsigned type=0){ use_binary_mask(avgFactor, fwidth, type); }
void calcWeights( float sampleRate, const gsl_matrix* delays){ calc_weights(sampleRate, delays); }
void calcWeightsN( float sampleRate, const gsl_matrix* delays, unsigned NC=2){ calc_weights_n(sampleRate, delays, NC); }
void setHiActiveWeights_f(unsigned fbinX, const gsl_vector* pkdWa, const gsl_vector* pkdwb, int option=0){
set_hi_active_weights_f(fbinX, pkdWa, pkdwb, option);
}
void setActiveWeights_f(unsigned fbinX, const gsl_matrix* packedWeights, int option=0){
set_active_weights_f(fbinX, packedWeights, option);
}
#endif /* #ifdef ENABLE_LEGACY_BTK_API */
private:
void calc_interference_outputs_();
void binary_masking_( gsl_vector_complex** interferenceOutputs, unsigned targetSourceX, gsl_vector_complex* output );
unsigned targetSourceX_; // the n-th source will be emphasized
unsigned nSource_; // the number of sound sources
int pftype_;
float alpha_;
bool use_binary_mask_; // true if you use a binary mask
unsigned binary_mask_type_;// 0:use GSC's outputs, 1:use outputs of the upper branch.
gsl_vector_complex** interference_outputs_;
gsl_vector_complex* avg_output_;
float avg_factor_;
unsigned fwidth_;
};
// ----- definition for class `SubbandMVDR' -----
//
/**
@class SubbandMVDR
@usage
1. setChannel()
2. calc_array_manifold_vectors(), calc_array_manifold_vectors2() or calc_array_manifold_vectorsN().
3. set_noise_spatial_spectral_matrix() or set_diffuse_noise_model()
4. calc_mvdr_weights()
*/
class SubbandMVDR : public SubbandDS {
public:
/**
@brief Basic MVDR beamformer implementation
@param int fftLen[in]
@param bool halfBandShift[in]
*/
SubbandMVDR(unsigned fftLen = 512, bool halfBandShift = false, const String& nm = "SubbandMVDR");
~SubbandMVDR();
virtual const gsl_vector_complex* next(int frame_no = -5);
virtual void clear_channel();
bool calc_mvdr_weights(float samplerate, float dThreshold = 1.0E-8, bool calcInverseMatrix = true);
const gsl_vector_complex* mvdr_weights(unsigned fbinX) const { return wmvdr_[fbinX]; }
const gsl_matrix_complex *noise_spatial_spectral_matrix(unsigned fbinX) const { return R_[fbinX]; }
bool set_noise_spatial_spectral_matrix(unsigned fbinX, gsl_matrix_complex* Rnn);
bool set_diffuse_noise_model(const gsl_matrix* micPositions, float samplerate, float sspeed = 343740.0); /* micPositions[][x,y,z] */
void set_all_diagonal_loading(float diagonalWeight);
void set_diagonal_looading(unsigned fbinX, float diagonalWeight);
/**
@brief Divide each non-diagonal elemnt by 1 + mu instead of diagonal loading. mu can be interpreted as the ratio of the sensor noise to the ambient noise power.
@param float mu[in]
*/
void divide_all_nondiagonal_elements(float mu){
for(unsigned fbinX=0;fbinX<=fftLen_/2;fbinX++)
divide_nondiagonal_elements( fbinX, mu );
}
void divide_nondiagonal_elements(unsigned fbinX, float mu);
gsl_matrix_complex** noise_spatial_spectral_matrix() const { return R_; }
#ifdef ENABLE_LEGACY_BTK_API
void clearChannel(){ clear_channel(); }
bool calcMVDRWeights( float sampleRate, float dThreshold = 1.0E-8, bool calcInverseMatrix = true ){ return calc_mvdr_weights(sampleRate, dThreshold, calcInverseMatrix); }
const gsl_vector_complex* getMVDRWeights(unsigned fbinX){ return mvdr_weights(fbinX); }
const gsl_matrix_complex *getNoiseSpatialSpectralMatrix(unsigned fbinX){ return noise_spatial_spectral_matrix(fbinX); }
bool setNoiseSpatialSpectralMatrix(unsigned fbinX, gsl_matrix_complex* Rnn){ return set_noise_spatial_spectral_matrix(fbinX, Rnn); }
bool setDiffuseNoiseModel(const gsl_matrix* micPositions, float sampleRate, float sspeed = 343740.0){ return set_diffuse_noise_model(micPositions, sampleRate, sspeed); }
void setAllLevelsOfDiagonalLoading(float diagonalWeight){ set_all_diagonal_loading(diagonalWeight); }
void setLevelOfDiagonalLoading(unsigned fbinX, float diagonalWeight){ set_diagonal_looading(fbinX, diagonalWeight); }
void divideAllNonDiagonalElements( float mu ){ divide_all_nondiagonal_elements(mu); }
void divideNonDiagonalElements( unsigned fbinX, float mu ){ divide_nondiagonal_elements(fbinX, mu); }
gsl_matrix_complex** getNoiseSpatialSpectralMatrix(){ return noise_spatial_spectral_matrix(); }
#endif /* #ifdef ENABLE_LEGACY_BTK_API */
protected:
gsl_matrix_complex** R_; /* Noise spatial spectral matrices */
gsl_matrix_complex** invR_;
gsl_vector_complex** wmvdr_;
float* diagonal_weights_;
};
// ----- definition for class `SubbandMVDRGSC' -----
//
/**
@class SubbandMVDRGSC
@usage
1. setChannel()
2. calc_array_manifold_vectors(), calc_array_manifold_vectors2() or calc_array_manifold_vectorsN().
3. set_noise_spatial_spectral_matrix() or set_diffuse_noise_model()
4. calc_mvdr_weights()
5. calc_blocking_matrix1() or calc_blocking_matrix2()
6. set_active_weights_f()
*/
class SubbandMVDRGSC : public SubbandMVDR {
public:
/**
@brief MVDR beamforming implementation
@param int fftLen[in]
@param bool halfBandShift[in]
*/
SubbandMVDRGSC(unsigned fftLen = 512, bool halfBandShift = false, const String& nm = "SubbandMVDR");
~SubbandMVDRGSC();
virtual const gsl_vector_complex* next(int frame_no = -5);
void set_active_weights_f(unsigned fbinX, const gsl_vector* packedWeight);
void zero_active_weights();
bool calc_blocking_matrix1(float samplerate, const gsl_vector* delaysT);
bool calc_blocking_matrix2();
void upgrade_blocking_matrix();
const gsl_vector_complex* blocking_matrix_output(int outChanX=0);
#ifdef ENABLE_LEGACY_BTK_API
void setActiveWeights_f(unsigned fbinX, const gsl_vector* packedWeight){ set_active_weights_f(fbinX, packedWeight); }
void zeroActiveWeights(){ zero_active_weights(); }
bool calcBlockingMatrix1(float sampleRate, const gsl_vector* delaysT){ return calc_blocking_matrix1(sampleRate, delaysT); }
bool calcBlockingMatrix2(){ return calc_blocking_matrix2(); }
void upgradeBlockingMatrix(){ upgrade_blocking_matrix(); }
const gsl_vector_complex* blockingMatrixOutput(int outChanX=0){ return blocking_matrix_output(outChanX); }
#endif
protected:
bool normalize_weight_;
};
typedef Inherit<SubbandBeamformer, VectorComplexFeatureStreamPtr> SubbandBeamformerPtr;
typedef Inherit<SubbandDS, SubbandBeamformerPtr> SubbandDSPtr;
typedef Inherit<SubbandGSC, SubbandDSPtr> SubbandGSCPtr;
typedef Inherit<SubbandGSCRLS, SubbandGSCPtr> SubbandGSCRLSPtr;
typedef Inherit<SubbandMMI, SubbandDSPtr> SubbandMMIPtr;
typedef Inherit<SubbandMVDR, SubbandDSPtr> SubbandMVDRPtr;
typedef Inherit<SubbandMVDRGSC, SubbandMVDRPtr> SubbandMVDRGSCPtr;
// ----- members for class `SubbandOrthogonalizer' -----
//
class SubbandOrthogonalizer : public VectorComplexFeatureStream {
public:
SubbandOrthogonalizer(SubbandMVDRGSCPtr &beamformer, int outChanX=0, const String& nm = "SubbandOrthogonalizer");
~SubbandOrthogonalizer();
virtual const gsl_vector_complex* next(int frame_no = -5);
private:
SubbandMVDRGSCPtr beamformer_;
int outChanX_;
};
typedef Inherit<SubbandOrthogonalizer, VectorComplexFeatureStreamPtr> SubbandOrthogonalizerPtr;
class SubbandBlockingMatrix : public SubbandGSC {
public:
SubbandBlockingMatrix(unsigned fftLen=512, bool halfBandShift=false, const String& nm = "SubbandBlockingMatrix")
:SubbandGSC(fftLen, halfBandShift, nm ){;}
~SubbandBlockingMatrix();
virtual const gsl_vector_complex* next(int frame_no = -5);
};
// ----- definition for class DOAEstimatorSRPBase' -----
//
class DOAEstimatorSRPBase {
public:
DOAEstimatorSRPBase( unsigned nBest, unsigned fbinMax );
virtual ~DOAEstimatorSRPBase();
const gsl_vector *nbest_rps() const { return nBestRPs_; }
const gsl_matrix *nbest_doas() const { return argMaxDOAs_;}
const gsl_matrix *response_power_matrix() const { return rpMat_;}
float energy() const {return energy_;}
void final_nbest_hypotheses(){get_nbest_hypotheses_from_accrp_();}
void set_energy_threshold(float engeryThreshold){ engery_threshold_ = engeryThreshold; }
void set_frequency_range(unsigned fbinMin, unsigned fbinMax){ fbinMin_ = fbinMin; fbinMax_ = fbinMax;}
void init_accs(){ init_accs_(); }
void set_search_param(float minTheta=-M_PI/2, float maxTheta=M_PI/2,
float minPhi=-M_PI/2, float maxPhi=M_PI/2,
float widthTheta=0.1, float widthPhi=0.1);
#ifdef ENABLE_LEGACY_BTK_API
const gsl_vector *getNBestRPs(){ return nbest_rps(); }
const gsl_matrix *getNBestDOAs(){ return nbest_doas(); }
const gsl_matrix *getResponsePowerMatrix(){ return response_power_matrix(); }
float getEnergy(){return energy();}
void getFinalNBestHypotheses(){ final_nbest_hypotheses(); }
void setEnergyThreshold(float engeryThreshold){ set_energy_threshold(engeryThreshold); }
void setFrequencyRange(unsigned fbinMin, unsigned fbinMax){ set_frequency_range(fbinMin, fbinMax); }
void initAccs(){ init_accs(); }
void setSearchParam(float minTheta=-M_PI/2, float maxTheta=M_PI/2,
float minPhi=-M_PI/2, float maxPhi=M_PI/2,
float widthTheta=0.1, float widthPhi=0.1)
{
set_search_param(minTheta, maxTheta, minPhi, maxPhi, widthTheta, widthPhi);
}
#endif
protected:
void clear_table_();
virtual void get_nbest_hypotheses_from_accrp_();
virtual void init_accs_();
float widthTheta_;
float widthPhi_;
float minTheta_;
float maxTheta_;
float minPhi_;
float maxPhi_;
unsigned nTheta_;
unsigned nPhi_;
unsigned fbinMin_;
unsigned fbinMax_;
unsigned nBest_;
bool table_initialized_;
gsl_vector *accRPs_;
gsl_vector *nBestRPs_;
gsl_matrix *argMaxDOAs_;
vector<gsl_vector_complex **> svTbl_; // [][fftL2+1][_dim]
gsl_matrix *rpMat_;
float engery_threshold_;
float energy_;
#ifdef __MBDEBUG__
void allocDebugWorkSapce();
#endif /* #ifdef __MBDEBUG__ */
};
// ----- definition for class DOAEstimatorSRPDSBLA' -----
//
/**
@brief estimate the direction of arrival based on the maximum steered response power
@usage
1. construct an object
2. set the geometry of the linear array
3. call next()
*/
class DOAEstimatorSRPDSBLA :
public DOAEstimatorSRPBase, public SubbandDS {
public:
DOAEstimatorSRPDSBLA( unsigned nBest, unsigned samplerate, unsigned fftLen, const String& nm="DOAEstimatorSRPDSBLA" );
~DOAEstimatorSRPDSBLA();
const gsl_vector_complex* next(int frame_no = -5);
void reset();
void set_array_geometry(gsl_vector *positions);
#ifdef ENABLE_LEGACY_BTK_API
void setArrayGeometry(gsl_vector *positions){ set_array_geometry(positions); }
#endif
protected:
virtual void calc_steering_unit_table_();
virtual float calc_response_power_( unsigned uttX );
private:
virtual void set_look_direction_( int nChan, float theta );
unsigned samplerate_;
gsl_matrix *arraygeometry_; // [micX][x,y,z]
};
typedef refcount_ptr<DOAEstimatorSRPBase> DOAEstimatorSRPBasePtr;
typedef Inherit<DOAEstimatorSRPDSBLA, SubbandDSPtr> DOAEstimatorSRPDSBLAPtr;
// ----- definition for functions' -----
//
float calc_energy(SnapShotArrayPtr snapShotArray, unsigned fbinMin, unsigned fbinMax, unsigned fftLen2, bool halfBandShift=false);
void calc_gsc_output(const gsl_vector_complex* snapShot,
gsl_vector_complex* wl_f, gsl_vector_complex* wq_f,
gsl_complex *pYf, bool normalizeWeight=false );
bool pseudoinverse( gsl_matrix_complex *A, gsl_matrix_complex *invA, float dThreshold = 1.0E-8 );
void calc_all_delays(float x, float y, float z, const gsl_matrix* mpos, gsl_vector* delays);
void calc_product(gsl_vector_complex* synthesisSamples, gsl_matrix_complex* gs_W, gsl_vector_complex* product);
#ifdef ENABLE_LEGACY_BTK_API
inline void calcAllDelays(float x, float y, float z, const gsl_matrix* mpos, gsl_vector* delays)
{
calc_all_delays(x, y, z, mpos, delays);
}
inline void calcProduct(gsl_vector_complex* synthesisSamples, gsl_matrix_complex* gs_W, gsl_vector_complex* product)
{
calc_product(synthesisSamples, gs_W, product);
}
#endif
#endif
|
State Before: R : Type u_1
S : Type ?u.130363
M : Type ?u.130366
inst✝ : CommRing R
a b : R
⊢ (a - b) ^ 2 = a ^ 2 + b ^ 2 - 2 * a * b State After: no goals Tactic: rw [sub_eq_add_neg, add_sq', neg_sq, mul_neg, ← sub_eq_add_neg]
|
lemma linear_inj_bounded_below_pos: fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::euclidean_space" assumes "linear f" "inj f" obtains B where "B > 0" "\<And>x. B * norm x \<le> norm(f x)"
|
(* Title: JinjaThreads/MM/JMM_Compiler.thy
Author: Andreas Lochbihler
Compiler correctness for the JMM
*)
header {* \isaheader{Compiler correctness for the JMM} *}
theory JMM_Compiler imports
JMM_J
JMM_JVM
"../Compiler/Correctness"
"../Framework/FWBisimLift"
begin
lemma action_loc_aux_compP [simp]: "action_loc_aux (compP f P) = action_loc_aux P"
by(auto 4 4 elim!: action_loc_aux_cases)
lemma action_loc_compP: "action_loc (compP f P) = action_loc P"
by simp
lemma is_volatile_compP [simp]: "is_volatile (compP f P) = is_volatile P"
proof(rule ext)
fix hT
show "is_volatile (compP f P) hT = is_volatile P hT"
by(cases hT) simp_all
qed
lemma saction_compP [simp]: "saction (compP f P) = saction P"
by(simp add: saction.simps fun_eq_iff)
lemma sactions_compP [simp]: "sactions (compP f P) = sactions P"
by(rule ext)(simp only: sactions_def, simp)
lemma addr_locs_compP [simp]: "addr_locs (compP f P) = addr_locs P"
by(rule ext)(case_tac x, simp_all)
lemma syncronizes_with_compP [simp]: "synchronizes_with (compP f P) = synchronizes_with P"
by(simp add: synchronizes_with.simps fun_eq_iff)
lemma sync_order_compP [simp]: "sync_order (compP f P) = sync_order P"
by(simp add: sync_order_def fun_eq_iff)
lemma sync_with_compP [simp]: "sync_with (compP f P) = sync_with P"
by(simp add: sync_with_def fun_eq_iff)
lemma po_sw_compP [simp]: "po_sw (compP f P) = po_sw P"
by(simp add: po_sw_def fun_eq_iff)
lemma happens_before_compP: "happens_before (compP f P) = happens_before P"
by simp
lemma addr_loc_default_compP [simp]: "addr_loc_default (compP f P) = addr_loc_default P"
proof(intro ext)
fix hT al
show "addr_loc_default (compP f P) hT al = addr_loc_default P hT al"
by(cases "(P, hT, al)" rule: addr_loc_default.cases) simp_all
qed
lemma value_written_aux_compP [simp]: "value_written_aux (compP f P) = value_written_aux P"
proof(intro ext)
fix a al
show "value_written_aux (compP f P) a al = value_written_aux P a al"
by(cases "(P, a, al)" rule: value_written_aux.cases)(simp_all add: value_written_aux.simps)
qed
lemma value_written_compP [simp]: "value_written (compP f P) = value_written P"
by(simp add: fun_eq_iff value_written.simps)
lemma is_write_seen_compP [simp]: "is_write_seen (compP f P) = is_write_seen P"
by(simp add: fun_eq_iff is_write_seen_def)
lemma justification_well_formed_compP [simp]:
"justification_well_formed (compP f P) = justification_well_formed P"
by(simp add: fun_eq_iff justification_well_formed_def)
lemma happens_before_committed_compP [simp]:
"happens_before_committed (compP f P) = happens_before_committed P"
by(simp add: fun_eq_iff happens_before_committed_def)
lemma happens_before_committed_weak_compP [simp]:
"happens_before_committed_weak (compP f P) = happens_before_committed_weak P"
by(simp add: fun_eq_iff happens_before_committed_weak_def)
lemma sync_order_committed_compP [simp]:
"sync_order_committed (compP f P) = sync_order_committed P"
by(simp add: fun_eq_iff sync_order_committed_def)
lemma value_written_committed_compP [simp]:
"value_written_committed (compP f P) = value_written_committed P"
by(simp add: fun_eq_iff value_written_committed_def)
lemma uncommitted_reads_see_hb_compP [simp]:
"uncommitted_reads_see_hb (compP f P) = uncommitted_reads_see_hb P"
by(simp add: fun_eq_iff uncommitted_reads_see_hb_def)
lemma external_actions_committed_compP [simp]:
"external_actions_committed (compP f P) = external_actions_committed P"
by(simp add: fun_eq_iff external_actions_committed_def)
lemma is_justified_by_compP [simp]: "is_justified_by (compP f P) = is_justified_by P"
by(simp add: fun_eq_iff is_justified_by.simps)
lemma is_weakly_justified_by_compP [simp]: "is_weakly_justified_by (compP f P) = is_weakly_justified_by P"
by(simp add: fun_eq_iff is_weakly_justified_by.simps)
lemma legal_execution_compP: "legal_execution (compP f P) = legal_execution P"
by(simp add: fun_eq_iff gen_legal_execution.simps)
lemma weakly_legal_execution_compP: "weakly_legal_execution (compP f P) = weakly_legal_execution P"
by(simp add: fun_eq_iff gen_legal_execution.simps)
lemma most_recent_write_for_compP [simp]:
"most_recent_write_for (compP f P) = most_recent_write_for P"
by(simp add: fun_eq_iff most_recent_write_for.simps)
lemma sequentially_consistent_compP [simp]:
"sequentially_consistent (compP f P) = sequentially_consistent P"
by(simp add: sequentially_consistent_def split_beta)
lemma conflict_compP [simp]: "non_volatile_conflict (compP f P) = non_volatile_conflict P"
by(simp add: fun_eq_iff non_volatile_conflict_def)
lemma correctly_synchronized_compP [simp]:
"correctly_synchronized (compP f P) = correctly_synchronized P"
by(simp add: fun_eq_iff correctly_synchronized_def)
lemma (in heap_base) heap_read_typed_compP [simp]:
"heap_read_typed (compP f P) = heap_read_typed P"
by(intro ext)(simp add: heap_read_typed_def)
context J_JVM_heap_conf_base begin
definition if_bisimJ2JVM ::
"(('addr,'thread_id,status \<times> 'addr expr\<times>'addr locals,'heap,'addr) state,
('addr,'thread_id,status \<times> 'addr option \<times> 'addr frame list,'heap,'addr) state) bisim"
where
"if_bisimJ2JVM =
FWbisimulation_base.mbisim red_red0.init_fin_bisim red_red0.init_fin_bisim_wait \<circ>\<^sub>B
FWbisimulation_base.mbisim red0_Red1'.init_fin_bisim red0_Red1'.init_fin_bisim_wait \<circ>\<^sub>B
if_mbisim_Red1'_Red1 \<circ>\<^sub>B
FWbisimulation_base.mbisim Red1_execd.init_fin_bisim Red1_execd.init_fin_bisim_wait"
definition if_tlsimJ2JVM ::
"('thread_id \<times> ('addr, 'thread_id, status \<times> 'addr expr \<times> 'addr locals,
'heap, 'addr, ('addr, 'thread_id) obs_event action) thread_action,
'thread_id \<times> ('addr, 'thread_id, status \<times> 'addr jvm_thread_state,
'heap, 'addr, ('addr, 'thread_id) obs_event action) thread_action) bisim"
where
"if_tlsimJ2JVM =
FWbisimulation_base.mta_bisim red_red0.init_fin_bisim \<circ>\<^sub>B
FWbisimulation_base.mta_bisim red0_Red1'.init_fin_bisim \<circ>\<^sub>B op = \<circ>\<^sub>B
FWbisimulation_base.mta_bisim Red1_execd.init_fin_bisim"
end
sublocale J_JVM_conf_read < red_mthr!: if_\<tau>multithreaded_wf final_expr "mred P" convert_RA "\<tau>MOVE P"
by(unfold_locales)
sublocale J_JVM_conf_read < execd_mthr!:
if_\<tau>multithreaded_wf
JVM_final
"mexecd (compP2 (compP1 P))"
convert_RA
"\<tau>MOVE2 (compP2 (compP1 P))"
by(unfold_locales)
context J_JVM_conf_read begin
theorem if_bisimJ2JVM_weak_bisim:
assumes wf: "wf_J_prog P"
shows "delay_bisimulation_diverge_final
(red_mthr.mthr.if.redT P) (execd_mthr.mthr.if.redT (J2JVM P)) if_bisimJ2JVM if_tlsimJ2JVM
red_mthr.if.m\<tau>move execd_mthr.if.m\<tau>move red_mthr.mthr.if.mfinal execd_mthr.mthr.if.mfinal"
unfolding if_bisimJ2JVM_def if_tlsimJ2JVM_def J2JVM_def o_apply
apply(rule delay_bisimulation_diverge_final_compose)
apply(rule FWdelay_bisimulation_diverge.mthr_delay_bisimulation_diverge_final)
apply(rule FWdelay_bisimulation_diverge.init_fin_FWdelay_bisimulation_diverge)
apply(rule red_red0_FWbisim[OF wf_prog_wwf_prog[OF wf]])
apply(rule delay_bisimulation_diverge_final_compose)
apply(rule FWdelay_bisimulation_diverge.mthr_delay_bisimulation_diverge_final)
apply(rule FWdelay_bisimulation_diverge.init_fin_FWdelay_bisimulation_diverge)
apply(rule red0_Red1'_FWweak_bisim[OF wf])
apply(rule delay_bisimulation_diverge_final_compose)
apply(rule delay_bisimulation_diverge_final.intro)
apply(rule bisimulation_into_delay.delay_bisimulation)
apply(rule if_Red1'_Red1_bisim_into_weak[OF compP1_pres_wf[OF wf]])
apply(rule bisimulation_final.delay_bisimulation_final_base)
apply(rule if_Red1'_Red1_bisimulation_final[OF compP1_pres_wf[OF wf]])
apply(rule FWdelay_bisimulation_diverge.mthr_delay_bisimulation_diverge_final)
apply(rule FWdelay_bisimulation_diverge.init_fin_FWdelay_bisimulation_diverge)
apply(rule Red1_exec1_FWwbisim[OF compP1_pres_wf[OF wf]])
done
lemma if_bisimJ2JVM_start:
assumes wf: "wf_J_prog P"
and wf_start: "wf_start_state P C M vs"
shows "if_bisimJ2JVM (init_fin_lift_state Running (J_start_state P C M vs))
(init_fin_lift_state Running (JVM_start_state (J2JVM P) C M vs))"
using assms
unfolding if_bisimJ2JVM_def J2JVM_def o_apply
apply(intro bisim_composeI)
apply(rule FWbisimulation_base.init_fin_lift_state_mbisimI)
apply(erule (1) bisim_J_J0_start[OF wf_prog_wwf_prog])
apply(rule FWbisimulation_base.init_fin_lift_state_mbisimI)
apply(erule (1) bisim_J0_J1_start)
apply(erule if_bisim_J1_J1_start[OF compP1_pres_wf])
apply simp
apply(rule FWbisimulation_base.init_fin_lift_state_mbisimI)
apply(erule bisim_J1_JVM_start[OF compP1_pres_wf])
apply simp
done
lemma red_Runs_eq_mexecd_Runs:
fixes C M vs
defines s: "s \<equiv> init_fin_lift_state Running (J_start_state P C M vs)"
and comps: "cs \<equiv> init_fin_lift_state Running (JVM_start_state (J2JVM P) C M vs)"
assumes wf: "wf_J_prog P"
and wf_start: "wf_start_state P C M vs"
shows "red_mthr.mthr.if.\<E> P s = execd_mthr.mthr.if.\<E> (J2JVM P) cs"
proof -
from wf wf_start have bisim: "if_bisimJ2JVM s cs"
unfolding s comps by(rule if_bisimJ2JVM_start)
interpret divfin!: delay_bisimulation_diverge_final
"red_mthr.mthr.if.redT P"
"execd_mthr.mthr.if.redT (J2JVM P)"
"if_bisimJ2JVM"
"if_tlsimJ2JVM"
"red_mthr.if.m\<tau>move"
"execd_mthr.if.m\<tau>move"
"red_mthr.mthr.if.mfinal"
"execd_mthr.mthr.if.mfinal"
using wf by(rule if_bisimJ2JVM_weak_bisim)
show ?thesis (is "?lhs = ?rhs")
proof(intro equalityI subsetI)
fix E
assume "E \<in> ?lhs"
then obtain E' where E: "E = lconcat (lmap (\<lambda>(t, ta). llist_of (map (Pair t) \<lbrace>ta\<rbrace>\<^bsub>o\<^esub>)) (llist_of_tllist E'))"
and E': "red_mthr.if.mthr.\<tau>Runs s E'"
unfolding red_mthr.if.\<E>_conv_Runs by blast
from divfin.simulation_\<tau>Runs1[OF bisim E']
obtain E'' where E'': "execd_mthr.if.mthr.\<tau>Runs cs E''"
and tlsim: "tllist_all2 if_tlsimJ2JVM (option.rel_option if_bisimJ2JVM) E' E''"
unfolding J2JVM_def o_apply by blast
let ?E = "lconcat (lmap (\<lambda>(t, ta). llist_of (map (Pair t) \<lbrace>ta\<rbrace>\<^bsub>o\<^esub>)) (llist_of_tllist E''))"
from tlsim have "llist_all2 if_tlsimJ2JVM (llist_of_tllist E') (llist_of_tllist E'')"
by(rule tllist_all2D_llist_all2_llist_of_tllist)
hence "llist_all2 (op =) (lmap (\<lambda>(t, ta). llist_of (map (Pair t) \<lbrace>ta\<rbrace>\<^bsub>o\<^esub>)) (llist_of_tllist E'))
(lmap (\<lambda>(t, ta). llist_of (map (Pair t) \<lbrace>ta\<rbrace>\<^bsub>o\<^esub>)) (llist_of_tllist E''))"
unfolding llist_all2_lmap1 llist_all2_lmap2
by(rule llist_all2_mono)(auto simp add: if_tlsimJ2JVM_def FWbisimulation_base.mta_bisim_def ta_bisim_def)
hence "?E = E" unfolding llist.rel_eq E by simp
also from E'' have "?E \<in> ?rhs" unfolding J2JVM_def o_apply execd_mthr.if.\<E>_conv_Runs by blast
finally (subst) show "E \<in> ?rhs" .
next
fix E
assume "E \<in> ?rhs"
then obtain E' where E: "E = lconcat (lmap (\<lambda>(t, ta). llist_of (map (Pair t) \<lbrace>ta\<rbrace>\<^bsub>o\<^esub>)) (llist_of_tllist E'))"
and E': "execd_mthr.if.mthr.\<tau>Runs cs E'"
unfolding execd_mthr.if.\<E>_conv_Runs J2JVM_def o_apply by blast
from divfin.simulation_\<tau>Runs2[OF bisim, unfolded J2JVM_def o_apply, OF E']
obtain E'' where E'': "red_mthr.if.mthr.\<tau>Runs s E''"
and tlsim: "tllist_all2 if_tlsimJ2JVM (option.rel_option if_bisimJ2JVM) E'' E'" by blast
let ?E = "lconcat (lmap (\<lambda>(t, ta). llist_of (map (Pair t) \<lbrace>ta\<rbrace>\<^bsub>o\<^esub>)) (llist_of_tllist E''))"
from tlsim have "llist_all2 if_tlsimJ2JVM (llist_of_tllist E'') (llist_of_tllist E')"
by(rule tllist_all2D_llist_all2_llist_of_tllist)
hence "llist_all2 (op =) (lmap (\<lambda>(t, ta). llist_of (map (Pair t) \<lbrace>ta\<rbrace>\<^bsub>o\<^esub>)) (llist_of_tllist E''))
(lmap (\<lambda>(t, ta). llist_of (map (Pair t) \<lbrace>ta\<rbrace>\<^bsub>o\<^esub>)) (llist_of_tllist E'))"
unfolding llist_all2_lmap1 llist_all2_lmap2
by(rule llist_all2_mono)(auto simp add: if_tlsimJ2JVM_def FWbisimulation_base.mta_bisim_def ta_bisim_def)
hence "?E = E" unfolding llist.rel_eq E by simp
also from E'' have "?E \<in> ?lhs" unfolding red_mthr.if.\<E>_conv_Runs by blast
finally (subst) show "E \<in> ?lhs" .
qed
qed
lemma red_\<E>_eq_mexecd_\<E>:
"\<lbrakk> wf_J_prog P; wf_start_state P C M vs \<rbrakk>
\<Longrightarrow> J_\<E> P C M vs Running = JVMd_\<E> (J2JVM P) C M vs Running"
by(simp only: red_Runs_eq_mexecd_Runs)
theorem J2JVM_jmm_correct:
assumes wf: "wf_J_prog P"
and wf_start: "wf_start_state P C M vs"
shows "legal_execution P (J_\<E> P C M vs Running) (E, ws) \<longleftrightarrow>
legal_execution (J2JVM P) (JVMd_\<E> (J2JVM P) C M vs Running) (E, ws)"
by(simp only: red_\<E>_eq_mexecd_\<E>[OF assms] J2JVM_def o_apply compP1_def compP2_def legal_execution_compP)
theorem J2JVM_jmm_correct_weak:
assumes wf: "wf_J_prog P"
and wf_start: "wf_start_state P C M vs"
shows "weakly_legal_execution P (J_\<E> P C M vs Running) (E, ws) \<longleftrightarrow>
weakly_legal_execution (J2JVM P) (JVMd_\<E> (J2JVM P) C M vs Running) (E, ws)"
by(simp only: red_\<E>_eq_mexecd_\<E>[OF assms] J2JVM_def o_apply compP1_def compP2_def weakly_legal_execution_compP)
theorem J2JVM_jmm_correctly_synchronized:
assumes wf: "wf_J_prog P"
and wf_start: "wf_start_state P C M vs"
shows "correctly_synchronized (J2JVM P) (JVMd_\<E> (J2JVM P) C M vs Running) \<longleftrightarrow>
correctly_synchronized P (J_\<E> P C M vs Running)"
by(simp only: red_\<E>_eq_mexecd_\<E>[OF assms] J2JVM_def o_apply compP1_def compP2_def correctly_synchronized_compP)
end
end
|
module Frontend.Kotlin.AST
import Tools.AstF
import Tools.FullList
import Tools.Annotation
import Data.So
import Data.Vect
%access public export
-- _ ____ _____ _____ _
-- / \ / ___|_ _| | ___| _ _ __ ___| |_ ___ _ __
-- / _ \ \___ \ | | | |_ | | | | '_ \ / __| __/ _ \| '__|
-- / ___ \ ___) || | | _|| |_| | | | | (__| || (_) | |
-- /_/ \_\____/ |_| |_| \__,_|_| |_|\___|\__\___/|_|
--
data Operator = RefEq | RefNeq
| StructEq | StructNeq
| Lt | Le | Gt | Ge
| Plus | Subs | Mult | Div | Modulo
| And | Or
operatorLvl : Operator -> Nat
operatorLvl RefEq = 6
operatorLvl RefNeq = 6
operatorLvl StructEq = 6
operatorLvl StructNeq = 6
operatorLvl Lt = 5
operatorLvl Le = 5
operatorLvl Gt = 5
operatorLvl Ge = 5
operatorLvl Plus = 4
operatorLvl Subs = 4
operatorLvl Mult = 3
operatorLvl Div = 3
operatorLvl Modulo = 3
operatorLvl And = 7
operatorLvl Or = 8
Show Operator where
show RefEq = "==="
show RefNeq = "!=="
show StructEq = "=="
show StructNeq = "!="
show Lt = "<"
show Le = "<="
show Gt = ">"
show Ge = ">="
show Plus = "+"
show Subs = "-"
show Mult = "*"
show Div = "/"
show Modulo = "%"
show And = "&&"
show Or = "||"
Ident : Type
Ident = String
data SyntaxType = TypeTy | VarTy | ParamTy | ParamCTy
| ClassTy | FunTy | DeclTy | FileTy
| ExprTy | BlockTy | BlockExprTy | AccessTy
data SyntaxF : (k : SyntaxType -> Type) -> (i : SyntaxType) -> Type where
TParam : Ident -> List (k TypeTy) -> SyntaxF k TypeTy
TNull : k TypeTy -> SyntaxF k TypeTy
TFun : List (k TypeTy) -> k TypeTy -> SyntaxF k TypeTy
VVar : Ident -> Maybe (k TypeTy) -> k ExprTy -> SyntaxF k VarTy
VVal : Ident -> Maybe (k TypeTy) -> k ExprTy -> SyntaxF k VarTy
Param : Ident -> k TypeTy -> SyntaxF k ParamTy
PCVar : Ident -> k TypeTy -> SyntaxF k ParamCTy
PCVal : Ident -> k TypeTy -> SyntaxF k ParamCTy
Class : Ident -> List Ident -> List (k ParamCTy)
-> List (k VarTy) -> SyntaxF k ClassTy
Fun : List Ident -> Ident -> List (k ParamTy)
-> k TypeTy -> k BlockTy -> SyntaxF k FunTy
DVar : k VarTy -> SyntaxF k DeclTy
DClass : k ClassTy -> SyntaxF k DeclTy
DFun : k FunTy -> SyntaxF k DeclTy
File : List (k DeclTy) -> SyntaxF k FileTy
EInt : Integer -> SyntaxF k ExprTy
EStr : String -> SyntaxF k ExprTy
ETrue : SyntaxF k ExprTy
EFalse : SyntaxF k ExprTy
EThis : SyntaxF k ExprTy
ENull : SyntaxF k ExprTy
EAccess : k AccessTy -> SyntaxF k ExprTy
EAss : k AccessTy -> k ExprTy -> SyntaxF k ExprTy
ECall : Ident -> List (k ExprTy) -> SyntaxF k ExprTy
ENot : k ExprTy -> SyntaxF k ExprTy
EMinus : k ExprTy -> SyntaxF k ExprTy
EOp : Operator -> k ExprTy -> k ExprTy -> SyntaxF k ExprTy
EIfElse : k ExprTy -> k BlockExprTy -> k BlockExprTy -> SyntaxF k ExprTy
EWhile : k ExprTy -> k BlockExprTy -> SyntaxF k ExprTy
EReturn : Maybe (k ExprTy) -> SyntaxF k ExprTy
EFun : List (k ParamTy) -> k TypeTy -> k BlockTy -> SyntaxF k ExprTy
BEmpty : SyntaxF k BlockTy
BVar : k VarTy -> k BlockTy -> SyntaxF k BlockTy
BExpr : k ExprTy -> k BlockTy -> SyntaxF k BlockTy
BEBlock : k BlockTy -> SyntaxF k BlockExprTy
BEExpr : k ExprTy -> SyntaxF k BlockExprTy
AIdent : Ident -> SyntaxF k AccessTy
ASub : k ExprTy -> Ident -> SyntaxF k AccessTy
ANSub : k ExprTy -> Ident -> SyntaxF k AccessTy
-- _ _ _____ _ _
-- / \ ___| |_| ___| (_)_ __ ___| |_ __ _ _ __ ___ ___
-- / _ \ / __| __| |_ | | '_ \/ __| __/ _` | '_ \ / __/ _ \
-- / ___ \\__ \ |_| _| | | | | \__ \ || (_| | | | | (_| __/
-- /_/ \_\___/\__|_| |_|_| |_|___/\__\__,_|_| |_|\___\___|
--
AstF SyntaxType SyntaxF where
-- _ _ __ __
-- | |___ __ __ _| | \/ |__ _ _ __
-- | / _ \/ _/ _` | | |\/| / _` | '_ \
-- |_\___/\__\__,_|_|_| |_\__,_| .__/
-- |_|
localMap _ _ fn TypeTy (TParam x y) = TParam x $ map (fn TypeTy) y
localMap _ _ fn TypeTy (TNull x) = TNull $ fn TypeTy x
localMap _ _ fn TypeTy (TFun xs x) = TFun (map (fn TypeTy) xs) $ fn TypeTy x
localMap _ _ fn VarTy (VVar x y z) = VVar x (map (fn TypeTy) y) $ fn ExprTy z
localMap _ _ fn VarTy (VVal x y z) = VVal x (map (fn TypeTy) y) $ fn ExprTy z
localMap _ _ fn ParamTy (Param x y) = Param x $ fn TypeTy y
localMap _ _ fn ParamCTy (PCVar x y) = PCVar x $ (fn TypeTy) y
localMap _ _ fn ParamCTy (PCVal x y) = PCVal x $ (fn TypeTy) y
localMap _ _ fn ClassTy (Class x xs y ys) = Class x xs
(map (fn ParamCTy) y)
(map (fn VarTy) ys)
localMap _ _ fn FunTy (Fun xs x ys y z) = Fun xs x (map (fn ParamTy) ys)
(fn TypeTy y)
(fn BlockTy z)
localMap _ _ fn DeclTy (DVar x) = DVar $ fn VarTy x
localMap _ _ fn DeclTy (DClass x) = DClass $ fn ClassTy x
localMap _ _ fn DeclTy (DFun x) = DFun $ fn FunTy x
localMap _ _ fn FileTy (File xs) = File $ map (fn DeclTy) xs
localMap _ _ fn ExprTy (EInt x) = EInt x
localMap _ _ fn ExprTy (EStr x) = EStr x
localMap _ _ fn ExprTy ETrue = ETrue
localMap _ _ fn ExprTy EFalse = EFalse
localMap _ _ fn ExprTy EThis = EThis
localMap _ _ fn ExprTy ENull = ENull
localMap _ _ fn ExprTy (EAccess x) = EAccess $ fn AccessTy x
localMap _ _ fn ExprTy (EAss x y) = EAss (fn AccessTy x) (fn ExprTy y)
localMap _ _ fn ExprTy (ECall x xs) = ECall x (map (fn ExprTy) xs)
localMap _ _ fn ExprTy (ENot x) = ENot $ fn ExprTy x
localMap _ _ fn ExprTy (EMinus x) = EMinus $ fn ExprTy x
localMap _ _ fn ExprTy (EOp x y z) = EOp x (fn ExprTy y) (fn ExprTy z)
localMap _ _ fn ExprTy (EIfElse x y z) = EIfElse (fn ExprTy x)
(fn BlockExprTy y)
(fn BlockExprTy z)
localMap _ _ fn ExprTy (EWhile x y) = EWhile (fn ExprTy x) (fn BlockExprTy y)
localMap _ _ fn ExprTy (EReturn x) = EReturn $ map (fn ExprTy) x
localMap _ _ fn ExprTy (EFun xs x y) = EFun (map (fn ParamTy) xs)
(fn TypeTy x)
(fn BlockTy y)
localMap _ _ fn BlockTy BEmpty = BEmpty
localMap _ _ fn BlockTy (BVar x y) = BVar (fn VarTy x) (fn BlockTy y)
localMap _ _ fn BlockTy (BExpr x y) = BExpr (fn ExprTy x) (fn BlockTy y)
localMap _ _ fn BlockExprTy (BEBlock x) = BEBlock $ fn BlockTy x
localMap _ _ fn BlockExprTy (BEExpr x) = BEExpr $ fn ExprTy x
localMap _ _ fn AccessTy (AIdent x) = AIdent x
localMap _ _ fn AccessTy (ASub x y) = ASub (fn ExprTy x) y
localMap _ _ fn AccessTy (ANSub x y) = ANSub (fn ExprTy x) y
-- _ _ _ _
-- / \ _ __ _ __ ___ | |_ __ _| |_(_) ___ _ __
-- / _ \ | '_ \| '_ \ / _ \| __/ _` | __| |/ _ \| '_ \
-- / ___ \| | | | | | | (_) | || (_| | |_| | (_) | | | |
-- /_/ \_\_| |_|_| |_|\___/ \__\__,_|\__|_|\___/|_| |_|
--
SyntaxAnn : SyntaxType -> Type -> Type
SyntaxAnn = Annotated SyntaxType SyntaxF
-- _____
-- |_ _| _ _ __ ___
-- | || | | | '_ \ / _ \
-- | || |_| | |_) | __/
-- |_| \__, | .__/ \___|
-- |___/|_|
-- _ _ ___ _ ___
-- | || |/ _ \ /_\ / __|
-- | __ | (_) / _ \\__ \
-- |_||_|\___/_/ \_\___/
--
mutual
record KClass where
constructor MkClass
name : String
argc : Nat
members : List $ Pair String $ (Vect argc KType) -> KType
record KFun where
constructor MkFun
name : String
argc : Nat
args : List $ Pair String $ Vect argc KType -> KType
ret : Vect argc KType -> KType
data KType : Type where
KTFun : (f : KFun) -> Vect (argc f) KType -> KType
KTNull : KType
KTOpt : KType -> KType
KTClass : (c : KClass) -> Vect (argc c) KType -> KType
record Var where
constructor MkVar
name : String
type : KType
scope : Nat
-- TODO replace lists by SortedMap
record Environment where
constructor MkEnv
classes : List KClass
functions : List KFun
variables : List (List Var)
interface Named a where
name : a -> String
Named KClass where
name = KClass.name
Named KFun where
name = KFun.name
Named Var where
name = Var.name
-- _ _ _
-- | | _____ __ __ | | _____ _____| |
-- | |__/ _ \ V V / | |__/ -_) V / -_) |
-- |____\___/\_/\_/ |____\___|\_/\___|_|
--
interface Named a => Lookable t a | t where
total lookupDef : t -> String -> Bool
total lookupObj : (objs : t) -> (c : String) -> (So $ lookupDef objs c) -> a
total insertable : Bool
total subset : t -> t -> Type
total propagate : (c : String) -> (objs1 : t) -> (objs2 : t)
-> subset objs1 objs -> (So $ lookupDef objs1 c)
-> (So $ lookupDef objs2 c)
total insert : So insertable -> (objs : t) -> (obj : a)
-> (result : t ** (Pair (So $ lookupDef result $ name obj) (subset objs result)))
total namedLookupDef : Named a => a -> String -> Bool
namedLookupDef obj nm = case decEq (name obj) nm of
Yes _ => True
No _ => False
total namedLookupObj : Named a => (obj : a) -> (nm : String) -> (So $ namedLookupDef obj nm) -> a
namedLookupObj obj nm prf with (name obj == nm)
| True = obj
| False = void $ uninhabited prf
total namedSubset : Named a => a -> a -> Type
namedSubset obj1 obj2 = name obj1 = name obj2
total namedPropagate : Named a => (c : String) -> (obj1 : a) -> (obj2 : a)
-> namedSubset obj1 obj2 -> (So $ namedLookupDef obj1 c)
-> (So $ namedLookupDef obj2 c)
namedPropagate c obj1 obj2 sub prf with (name obj1 == name obj2)
| True with (name obj1 == c) proof eqC
| True = ?hole
| False = void $ uninhabited prf
| False = ?hole2
Lookable KClass KClass where
lookupDef = namedLookupDef
lookupObj = namedLookupObj
insertable = False
subset = namedSubset
Lookable KFun KFun where
lookupDef = namedLookupDef
lookupObj = namedLookupObj
insertable = False
subset = namedSubset
Lookable Var Var where
lookupDef = namedLookupDef
lookupObj = namedLookupObj
insertable = False
subset = namedSubset
total listLookupDef : Lookable t a => List t -> String -> Bool
listLookupDef [] _ = False
listLookupDef (h :: t) c = lookupDef h c || listLookupDef t c
Lookable t a => Lookable (List t) a where
lookupDef = listLookupDef
lookupObj (h :: t) c prf with (lookupDef h c) proof eq
| True = lookupObj h c $ replace eq prf
| False = lookupObj t c prf
insertable = True
-- _ _ _ _ _ _ _ _
-- | | | | |_(_) (_) |_(_)___ ___
-- | |_| | _| | | | _| / -_|_-<
-- \___/ \__|_|_|_|\__|_\___/__/
--
total hasClass : Environment -> String -> Type
hasClass env c = So $ lookupDef (classes env) c
total hasFun : Environment -> String -> Type
hasFun env c = So $ lookupDef (functions env) c
total hasVar : Environment -> String -> Type
hasVar env c = So $ lookupDef (variables env) c
total envClass : (e : Environment) -> (c : String) -> hasClass e c -> KClass
envClass env c prf = lookupObj (classes env) c prf
total envFun : (e : Environment) -> (c : String) -> hasFun e c -> KFun
envFun env c prf = lookupObj (functions env) c prf
total envVar : (e : Environment) -> (c : String) -> hasVar e c -> Var
envVar env c prf = lookupObj (variables env) c prf
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.