text
stringlengths 0
3.34M
|
---|
Set Automatic Coercions Import.
Require Import List Ensembles util stability flow list_util containers
geometry hs_solver concrete.
Require decreasing_exponential_flow EquivDec.
Set Implicit Arguments.
Module dec_exp_flow := decreasing_exponential_flow.
(* Locations *)
Inductive Location: Set := Heat | Cool | Check.
Instance Location_eq_dec: EquivDec.EqDec Location eq.
Proof. hs_solver. Defined.
Instance locations: ExhaustiveList Location :=
{ exhaustive_list := Heat :: Cool :: Check :: nil }.
Proof. hs_solver. Defined.
Lemma NoDup_locations: NoDup locations.
Proof. hs_solver. Qed.
(* States *)
Let Point := geometry.Point.
Let State : Type := (Location * Point)%type.
Definition point: State -> Point := snd.
Definition location: State -> Location := fst.
Definition clock: State -> CR := fst ∘ point.
Definition temp: State -> CR := snd ∘ point.
(* Invariant *)
Open Local Scope CR_scope.
Definition invariant (s: State): Prop :=
0 <= clock s /\
match location s with
| Heat => temp s <= '10 /\ clock s <= '3
| Cool => '5 <= temp s
| Check => clock s <= 1
end.
Lemma invariant_wd: forall l l', l = l' ->
forall (p p': Point), p[=]p' -> (invariant (l, p) <-> invariant (l', p')).
Proof. unfold invariant.
admit. (* grind ltac:(destruct l').*) (* TODO *)
Qed.
Lemma invariant_stable s: Stable (invariant s).
Proof. revert s. intros [l p]. destruct l; intros; unfold invariant; simpl location; auto. Qed.
(* Initial *)
Definition initial (s: State): Prop :=
location s = Heat /\
'5 <= temp s /\ temp s <= '10 /\
clock s == 0.
Lemma initial_invariant (s: State): initial s -> invariant s.
Proof. unfold initial, invariant.
admit. (* hs_solver. *) (* TODO *)
Qed.
(* Flow *)
Definition clock_flow (l: Location): Flow CRasCSetoid := flow.positive_linear.f.
Definition temp_flow (l: Location): Flow CRasCSetoid :=
match l with
| Heat => flow.scale.flow ('2) flow.positive_linear.f
| Cool => dec_exp_flow.f
| Check => flow.scale.flow ('(1#2)) dec_exp_flow.f
end.
Definition flow l := product_flow (clock_flow l) (temp_flow l).
(* Reset *)
Definition reset (l l': Location) (p: Point): Point :=
( match l, l' with
| Cool, Heat | Heat, Check | Check, Heat => 0
| _, _ => fst p
end
, snd p).
(* Guard *)
Definition guard (s: State) (l: Location): Prop :=
match location s, l with
| Heat, Cool => '9 <= temp s
| Cool, Heat => temp s <= '6
| Heat, Check => '2 <= clock s
| Check, Heat => '(1#2) <= clock s
| _, _ => False
end.
(* Concrete system itself *)
Definition system: System :=
Build_System
_ _
NoDup_locations
initial_invariant
invariant_wd
invariant_stable
flow
guard
reset.
(* Safety *)
Definition unsafe: Ensemble (concrete.State system) :=
fun s => temp s <= '(45#10).
Definition UnsafeUnreachable: Prop := unsafe ⊆ unreachable.
(* This is proved in safe.v. *)
(* We can also phrase the property less negatively: *)
Definition safe := Complement unsafe.
Definition ReachablesSafe: Prop := reachable ⊆ safe.
(* Of course, the negative version implies the positive one: *)
Goal UnsafeUnreachable -> ReachablesSafe.
Proof. intros H s A B. apply H with s; assumption. Qed.
|
# Week 1
__Goals for this week__
We will talk about the organization of this course, including the weekly tasks and 3 "mini"-projects that await you during on during this semester.
We will introduce the frameworks you will use and a you will get a geniality quick course (rychlokurz geniality) in Python, required library and standard structures.
__What is this file?__
This is a Jupyter notebook. A file, that contains python scripts and also stores the binary results.
__How can I run it?__
Firs you have to run/configure your Jupyter server in your desired python environment.
Then just follow this notebook and run it cell by cell. Try to answer - code - the questions, so you'll get better grasp on python array/list/dictionary structures.
## Task for today
Your first task is to configure python environment, Tensorflow (CPU or GPU based on you HW), PyTorch, and to practice python concepts in the scripts below.
You should understand it fully, otherwise review your knowledge before you proceed. The gained knowledge will be helpful for the next weeks tasks and then data processing for your projects.
```python
# Line comment
"""
Block comment
"""
# input and output
name=input()
print("Hello, "+name)
```
Hello, Neural Network
```python
# variables don't need explicit type declaration
var = 'Neural Networks rule!'
var = 2021
print(var)
var = 20.21
print(var)
var = True
print(var)
var = [29,1,2021]
print(var)
var = {'NN':'Rule!', 'year':2021}
print(var)
# Basic types
print(2022) # integer
print(13.07) # float
print('cool') # string
print(True, False) # boolean operands
print(None) # null-like operand
# python specific
print([12,34,'hello','world']) # list
print({123:456,'DL':'NN'}) # dictionary
# Type conversion
print(float('36.5'))
print(int(36.5))
print(str(3.65), 'length:', len(str(3.65)))
# Basic operations
a = 2 + 5 - 2.5
a += 3
b = 2 ** 3 # exponentiation
print(a, b)
print(5 / 2)
print(5 // 2) # Notice the difference between these two
print('DL' + 'NN')
# All compound assignment operators available
# including += -= *= **= /= //=
# pre/post in/decrementers not available (++ --)
# F-strings
print(f'1 + 2 = {1 + 2}, a = {a}')
print('1 + 2 = {1 + 2}, a = {a}') # We need the f at the start for {} to work as expression wrappers.
```
2021
20.21
True
[29, 1, 2021]
{'NN': 'Rule!', 'year': 2021}
2022
13.07
cool
True False
None
[12, 34, 'hello', 'world']
{123: 456, 'DL': 'NN'}
36.5
36
3.65 length: 4
7.5 8
2.5
2
DLNN
1 + 2 = 3, a = 7.5
1 + 2 = {1 + 2}, a = {a}
```python
# Conditions
a = 6
b = 2
if a > 4 and b < 3: # and, or and not are the basic logical operators
print('a') # Indentation by spaces or tabs tells us where the statement belongs. print('a') is in the if.
elif b > 5:
print('b') # Indentation by spaces or tabs tells us where the statement belongs. print('b') is in the elif.
else:
print('c') # Indentation by spaces or tabs tells us where the statement belongs. print('c') is in the else.
print('d') # But print('d') is outside, it will print every time.
# Loops
while a < 10:
if b > 3:
a += 1 # More indentation for code that is "deeper"
else:
a += 2
print(f'a = {a}')
# 'while' loops are not considered 'pythonic'. 'for' loops are more common
for char in 'string':
print(char)
```
a
d
a = 10
s
t
r
i
n
g
```python
# Lists - work like C arrays, but they are not dependent on element type
a = [1, 2.4, 10e-7, 0b1001, 'some "text"'] # embedded "" in '', works vice versa
len(a) # Length
print(a[1]) # Second element
print(a[1:3]) # Second to third element
a.append(4) # Adding at the end
del a[3] # Removing at the index
print([]) # Empty array
print(a)
# This is why for loops are used more often
for el in a:
# but be careful with iterations over list which contain different var types - it is your responsibility
print(el + 1)
```
```python
a = [1, 2.4, 10e-7, 0b1001]
# We can define lists with list comprehension statements
b = [el + 2 for el in a]
print(b)
```
[3, 4.4, 2.000001, 11]
```python
# Dictionaries - key-based structures
a = {
'layer_1': 'dense',
5: 'five',
4: 'four',
'result': [1, 2, 3]
}
print(a['layer_1'])
a['layer_2'] = 'ReLU'
if 'result' in a: # Does key exist?
print(a['result'])
{} # Empty
del a[5] # Remove record
print()
print('Keys:')
for key in a:
print(key)
print()
print('Keys and values:')
for key, value in a.items():
print(key, ':', value)
# Dictionaries can be also defined via comprehension statement
a = {i: i**2 for i in [1, 2, 3, 4]}
print(a)
```
dense
[1, 2, 3]
Keys:
layer_1
4
result
layer_2
Keys and values:
layer_1 : dense
4 : four
result : [1, 2, 3]
layer_2 : ReLU
{1: 1, 2: 4, 3: 9, 4: 16}
```python
# Most common and useful iterators
print('range(start, stop, step)')
for i in range(10,20,2):
print(i)
print()
print('enumerate')
lowercase = ['a', 'b', 'c']
for i, el in enumerate(lowercase): # iterates over elements attaching the index order
print(i, el)
print()
print('zip') # Like a zip - side-by-side merges lists together for iteration
uppercase = ['A', 'B', 'C']
numbers = [1,2,3]
for n, a, b in zip(numbers,lowercase, uppercase):
print(n, a, b)
```
range(start, stop, step)
10
12
14
16
18
enumerate
0 a
1 b
2 c
zip
1 a A
2 b B
3 c C
```python
# Functions
def example_function(a, b=1, c=1): # b and c have default values
return a*b, a*c # we return two values at the same time
a, b = example_function(1, 2, 3) # and we can assign both values at the same time as well
print(a, b)
print(example_function(4))
print(example_function(5, 2))
print(example_function(5, c=2)) # Notice how do the arguments behave
# Classes
class A:
def __init__(self, b): # Constructor
self.b = b # Object variable
def add_to_b(self, c): # self is always the first argument and it references the object itself
self.b += c
def sub_from_b(self, c):
self.add_to_b(-c) # Calling object method
def __str__(self): # every python class contain several default methods that start and end with __
return f'Class A, b={self.b}'
# be careful with naming and using underscores _
# private, protected and public is expressed by underscores
# default is public
def foo(self):
print("I'm public")
def _bar(self):
print("I'm protected")
def __nope(self):
print("You shall not print me, I'm private")
a = A(5)
a.add_to_b(1)
print(a.b)
a.sub_from_b(2)
print(a.b)
print(a)
a.foo()
a._bar()
a.__nope()
```
### Linear Algebra
Neural network models can be defined using vectors and matrices, i.e. concepts from linear algebra.
The _DeepLearningBook_ dedicates first pages for linear algebra, we will be using a bit of it during this semester, therefore you should know how basic linear operations work. Some of the concepts were covered during your _Algebra and Discrete Mathematics_ course. Read the provided links to review necessary topics (note that there are some questions at the end of each page) and solve the exercises in this notebook.
#### Vectors
- [On vectors](https://www.mathsisfun.com/algebra/vectors.html)
- [On dot product](https://www.mathsisfun.com/algebra/vectors-dot-product.html)
In these labs we use _DeepLearningBook_ notation: simple italic for scalars $x$, lowercase bold italic for vectors $\boldsymbol{x}$ and uppercase bold italics for matrices $\boldsymbol{X}$.
Please, keep this notation in mind.
### NumPy
[Numpy](https://numpy.org/) is a popular Python library for scientific computation. It provides a convenient way of working with vectors and matrices.
Use NumPy functions to solve these exercises.
```python
import numpy as np
```
```python
# Init vectors
a = np.array([0, 1, 3])
b = np.array([2, 4, 1])
# Other useful initializations
c = np.random.random(size=(3,1))
d = np.ones(shape=(1,3),dtype=float)
e = np.zeros(shape=(1,3),dtype=float)
print(c,d,e,sep='\n')
```
[[0.29856034]
[0.16234625]
[0.12413145]]
[[1. 1. 1.]]
[[0. 0. 0.]]
__Exercise:__ Determine whether two vectors (e.g. $\boldsymbol{a}$ and $\boldsymbol{b}$) are orthogonal (perpendicular)?
Your TODO (use numpy):
```python
# Orthogonality of vectors
print(np.dot(a,b) == 0)
```
False
```python
# Perpendicularity (similarity) of vectors
np.cross(a,b)
```
array([-11, 6, -2])
__Exercise:__ Compute which vector is longer, $\boldsymbol{a}$ or $\boldsymbol{b}$?
```python
# Length of vectors
l_a = np.linalg.norm(a)
l_b = np.linalg.norm(b)
print(f'a: {l_a} b: {l_b}')
if l_a > l_b:
print("a")
else:
print("b")
```
a: 3.1622776601683795 b: 4.58257569495584
b
#### Matrices
- [On matrices](https://www.mathsisfun.com/algebra/matrix-introduction.html)
- [On matrix multiplication](https://www.mathsisfun.com/algebra/matrix-multiplying.html)
__INFO: NumPy array indexing__
```python
# Indexing, i.e. selecting elements from an array / vector / matrix
W = np.array([
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
])
W[1, 1] # Element from second row of second column
W[0] # First row
W[[0, 2]] # First AND third row
W[:, 0] # First column
W[1, [0, 2]] # First AND third column of second row
# Access array slices by index
a = np.zeros([10,10])
a[:3] = 1
a[:, :3] = 2
a[:3, :3] = 3
rows = [4,6,7]
cols = [9,3,5]
a[rows, cols] = 4
print(a)
# transposition
a = np.arange(24).reshape(2,3,4)
print(a.shape)
print(a)
a=np.transpose(a, (2,1,0))
# swap 0th and 2nd axes
print(a.shape)
print(a)
```
[[3. 3. 3. 1. 1. 1. 1. 1. 1. 1.]
[3. 3. 3. 1. 1. 1. 1. 1. 1. 1.]
[3. 3. 3. 1. 1. 1. 1. 1. 1. 1.]
[2. 2. 2. 0. 0. 0. 0. 0. 0. 0.]
[2. 2. 2. 0. 0. 0. 0. 0. 0. 4.]
[2. 2. 2. 0. 0. 0. 0. 0. 0. 0.]
[2. 2. 2. 4. 0. 0. 0. 0. 0. 0.]
[2. 2. 2. 0. 0. 4. 0. 0. 0. 0.]
[2. 2. 2. 0. 0. 0. 0. 0. 0. 0.]
[2. 2. 2. 0. 0. 0. 0. 0. 0. 0.]]
(2, 3, 4)
[[[ 0 1 2 3]
[ 4 5 6 7]
[ 8 9 10 11]]
[[12 13 14 15]
[16 17 18 19]
[20 21 22 23]]]
(4, 3, 2)
[[[ 0 12]
[ 4 16]
[ 8 20]]
[[ 1 13]
[ 5 17]
[ 9 21]]
[[ 2 14]
[ 6 18]
[10 22]]
[[ 3 15]
[ 7 19]
[11 23]]]
```python
# Init matrices
# One way:
C = np.array([
[0, 2, 4],
[1, 2, 5]
])
d = np.array([1, 7])
# Other ways:
E = np.arange(4).reshape(2, 2)
F = np.ones(shape=(3,3),dtype=int)
G = np.zeros(shape=(3,3),dtype=int)
print(E,F,G,sep='\n\n')
```
[[0 1]
[2 3]]
[[1 1 1]
[1 1 1]
[1 1 1]]
[[0 0 0]
[0 0 0]
[0 0 0]]
```python
# There is a difference between a 1-D vector and a column matrix in numpy:
x1 = np.array([1, 2]) # This is a vector
x2 = np.array([ # This is a matrix
[1],
[2]
])
# First let's see the dimensions of these two
print(x1.shape)
print(x2.shape)
# Matrix - vector multiplication
# Then we can multiply them with E using np.matmul or @ matrix multiplication operator
print(E @ x1)
# TODO x_2^T \times E
np.transpose(x2)
```
(2,)
(2, 1)
[2 8]
array([[1, 2]])
### Loading files in python
#### Standard file types - image, csv, json, ...
```python
# imageio (or any other for image reading)
import imageio
import plotly.express as px
img_path = 'files/image.jpeg'
image = imageio.imread(img_path)
# image is a numpy array - you can do whatever you want to do with it as with an array
fig = px.imshow(image[0::50,0::50,:], title=img_path, width=800)
fig.show()
# there are many ways to import csv file
# if you are in doubt - use google - https://www.pythonpool.com/numpy-read-csv/
import csv
csv_path = 'files/iris.csv'
with open(csv_path, 'r') as f:
# csv data can be considered as lines of a list
csv_data = list(csv.reader(f, delimiter=','))
for line in range(10):
print(csv_data[line])
# Other possibility to store data is json
import json
json_path = 'files/titanic.json'
with open(json_path, 'r') as f:
json_data = json.load(f)
# json is stored as dictionary
print(json_data.keys())
```
<div> <div id="ef163e30-0a64-424a-876c-8cbd915567d2" class="plotly-graph-div" style="height:525px; width:800px;"></div> </div>
['sepal.length', 'sepal.width', 'petal.length', 'petal.width', 'variety']
['5.1', '3.5', '1.4', '.2', 'Setosa']
['4.9', '3', '1.4', '.2', 'Setosa']
['4.7', '3.2', '1.3', '.2', 'Setosa']
['4.6', '3.1', '1.5', '.2', 'Setosa']
['5', '3.6', '1.4', '.2', 'Setosa']
['5.4', '3.9', '1.7', '.4', 'Setosa']
['4.6', '3.4', '1.4', '.3', 'Setosa']
['5', '3.4', '1.5', '.2', 'Setosa']
['4.4', '2.9', '1.4', '.2', 'Setosa']
dict_keys(['metadata', 'data'])
### Derivatives
The final topic to cover are derivatives.
Almost all training algorithms of neural networks in practice are based on calculating the derivatives with respect to (w.r.t.) parameters of the model.
You should know the basics from your _Calculus course_ (Matematická analýza), but just in case, we recommend you to read the following to refresh your memory:
- [On derivatives](https://www.mathsisfun.com/calculus/derivatives-introduction.html)
You will need to use derivatives during this course only at the beginning, so you don't need to learn all the [derivative rules](https://www.mathsisfun.com/calculus/derivatives-rules.html), or you can help yourselves computationally.
However, we definitely need you to have an intuition about what derivatives are and what is their geometric interpretation. In essence, we need you to understand that a derivative tells us what is the slope of the tangent at given point. You should understand what is happening in the gif below:
```python
import plotly.graph_objects as go
x = np.linspace(-3,3,200)
fx = lambda x : x * np.sin(np.power(x, 2))
fdx = lambda x : np.sin(x**2)+ 2 * x**2 * np.cos(x**2)
y = fx(x)
A = -2
yd = fdx(A)
fig = go.Figure(data=go.Scatter(x=x,y=y, name='f(x)=x sin(x^2)+1'))
fig.add_trace(go.Scatter(x=[A],y=[fx(A)], name='A=f(-2),',mode='markers+text',text='A',textposition='middle right'))
line = lambda x,x1,y1: fdx(x1)*(x-x1)+y1
gx = np.linspace(A-0.2,A+0.2,20)
gy = line(gx, A, fx(A))
fig.add_trace(go.Scatter(x=gx,y=gy, line={'dash':'dash'}, name='Gradient in f(-2)\'=sin(x^2)+2x^2cos(x^2)'))
fig.show()
```
<div> <div id="eb8c2337-bb89-4cda-97b1-0a89160bc15d" class="plotly-graph-div" style="height:525px; width:100%;"></div> </div>
<center><small>License: en:User:Dino, User:Lfahlberg <a href="https://creativecommons.org/licenses/by-sa/3.0">CC BY-SA 3.0</a>, via Wikimedia Commons</small></center>
Partial derivatives are a concept you might have not head about before.
It is applied when we derive a function with more than one variable.
In such case we can actually derive a function in any direction.
Read the following link:
- [On partial derivatives](https://www.mathsisfun.com/calculus/derivatives-partial.html)
Function of one variable (1D) is a curve, and of two variables (2D) is a topographical relief.
2D function can be visualized by a 3D graph.
In this graph you can pick a point and then ask, what is a slope of the tangent in any direction.
Most commonly you would calculate the slope along axes of both variables (let's say $x,y$): $\frac{df}{dx}$ and $\frac{df}{dy}$.
Vector of derivatives w.r.t. all the parameters is called a _gradient_.
Generally for function $f$ with arbitrary number of parameters $x_1. x_2, ..., x_N = \boldsymbol{x}$, the gradient $\triangledown f$ is defined as:
\begin{equation}
\triangledown f(\boldsymbol{x}) = \frac{df}{d\boldsymbol{x}} = \begin{bmatrix}\frac{df}{dx_1} \\ \frac{df}{dx_2} \\ \vdots \\ \frac{df}{dx_N} \end{bmatrix}
\end{equation}
Gradient is the most important concept from this week's lab. The gradient is a vector quantity that tells us the _direction of steepest ascent_ at each point. This is a very important property, which we will often use in the following weeks. The magnitude of this vector tells us how steep this ascent is, i.e. what is the slope of the tangent in the direction of the gradient.
To compare _derivative_ and _gradient_:
- _Derivative_ is a quantity that tells us, what is the rate of change in given direction.
- _Gradient_ is a quantity that tells us what is the direction of the steepest rate of change, along with the rate of this change.
Observe the difference between these two concepts in two Figures below.
The first plot shows 2D function $f(x,y) = \sin(x) + \cos(y)$.
The next plot shows the values of derivatives of $f(x,y)$ as heatmap. Shows only the rate of change.
The partial derivatives would show arrows in the direction of $x$ or $y$ respectively according to the computed change. (You may plot them on your own)
The last plot shows gradients as blue arrows. Notice that they all point in the direction of the greatest change - as linear combination of partial derivatives.
```python
import plotly.figure_factory as ff
feature_x = np.arange(-np.pi, np.pi, np.pi/16)
feature_y = np.arange(-np.pi, np.pi, np.pi/16)
# Creating 2-D grid of features
[X, Y] = np.meshgrid(feature_x, feature_y)
Z = np.sin(X) + np.cos(Y)
fig = go.Figure(data = go.Heatmap(x = feature_x, y = feature_y, z = Z,))
fig.update_yaxes(scaleanchor='x',scaleratio=1)
fig.update_layout(height=600, width=800)
fig.show()
```
<div> <div id="b7cdbfe3-7a22-4c7f-a096-4680ded25d26" class="plotly-graph-div" style="height:600px; width:800px;"></div> </div>
```python
Z = np.cos(X) - np.sin(Y)
fig = go.Figure(data = go.Heatmap(x = feature_x, y = feature_y, z = Z,))
fig.update_yaxes(scaleanchor='x',scaleratio=1)
fig.update_layout(height=600, width=800)
fig.show()
```
<div> <div id="73946510-ff7e-4551-9ced-a9c1f4f90f21" class="plotly-graph-div" style="height:600px; width:800px;"></div> </div>
```python
U = np.cos(X)
V = np.sin(Y)
fig = ff.create_quiver(X,Y,U,V, scaleratio=1)
fig.update_layout(height=600, width=800)
fig.show()
```
<div> <div id="0890d65c-b5a2-4b55-8004-6b594c297b10" class="plotly-graph-div" style="height:600px; width:800px;"></div> </div>
|
import .aux.ncard
import .aux.helpers
-- noncomputable theory
open_locale classical
open_locale big_operators
open set
variables {E : Type*}
/-- A predicate `P` on sets satisfies the exchange property if, for all `X` and `Y` satisfying `P`
and all `a ∈ X \ Y`, there exists `b ∈ Y \ X` so that swapping `a` for `b` in `X` maintains `P`.-/
def exchange_property (P : set E → Prop) : Prop :=
∀ X Y, P X → P Y → ∀ a ∈ X \ Y, ∃ b ∈ Y \ X, P (insert b (X \ {a}))
/-- A `matroid` is a nonempty collection of sets satisfying the exchange property. Each such set
is called a `base` of the matroid. -/
@[ext] structure matroid (E : Type*) :=
(base : set E → Prop)
(exists_base' : ∃ B, base B)
(base_exchange' : exchange_property base)
instance {E : Type*} [finite E] :
finite (matroid E) :=
finite.of_injective (λ M, M.base) (λ M₁ M₂ h, (by {ext, dsimp only at h, rw h}))
instance {E : Type*} : nonempty (matroid E) :=
⟨⟨λ B, B = univ, ⟨_,rfl⟩, λ B B' hB hB' a ha, (ha.2 (by convert mem_univ a)).elim⟩⟩
namespace matroid
/- None of these definitions require finiteness -/
section defs
/-- A set is independent if it is contained in a base. -/
def indep (M : matroid E) (I : set E) : Prop :=
∃ B, M.base B ∧ I ⊆ B
/-- A basis for a set `X` is a maximal independent subset of `X`
(Often in the literature, the word 'basis' is used to refer to what we call a 'base')-/
def basis (M : matroid E) (I X : set E) : Prop :=
M.indep I ∧ I ⊆ X ∧ ∀ J, M.indep J → I ⊆ J → J ⊆ X → I = J
/-- A circuit is a minimal dependent set -/
def circuit (M : matroid E) (C : set E) : Prop :=
¬M.indep C ∧ ∀ I ⊂ C, M.indep I
/-- A flat is a maximal set having a given basis -/
def flat (M : matroid E) (F : set E) : Prop :=
∀ I X, M.basis I F → M.basis I X → X ⊆ F
/-- The closure of a set is the intersection of the flats containing it -/
def cl (M : matroid E) (X : set E) : set E :=
⋂₀ {F | M.flat F ∧ X ⊆ F}
/-- A hyperplane is a maximal proper subflat -/
def hyperplane (M : matroid E) (H : set E) : Prop :=
M.flat H ∧ H ⊂ univ ∧ (∀ F, H ⊂ F → M.flat F → F = univ)
/-- A cocircuit is the complement of a hyperplane -/
def cocircuit (M : matroid E) (K : set E) : Prop :=
M.hyperplane Kᶜ
/-- A coindependent set is one that contains no cocircuit -/
def coindep (M : matroid E) (I : set E) : Prop :=
¬ ∃ K ⊆ I, M.cocircuit K
/-- A loop is a singleton circuit -/
def loop (M : matroid E) (e : E) : Prop :=
M.circuit {e}
/-- A coloop is an element contained in every basis -/
def coloop (M : matroid E) (e : E) : Prop :=
∀ B, M.base B → e ∈ B
/-- The set of nonloops of `M` is the complement of the set `M.cl ∅` of loops -/
def nonloops (M : matroid E) : set E :=
(M.cl ∅)ᶜ
end defs
section base
variables {B B₁ B₂ I : set E} {M : matroid E} {e f x y : E}
lemma exists_base (M : matroid E) : ∃ B, M.base B := M.exists_base'
lemma base.exchange (hB₁ : M.base B₁) (hB₂ : M.base B₂) (hx : x ∈ B₁ \ B₂) :
∃ y ∈ B₂ \ B₁, M.base (insert y (B₁ \ {x})) :=
M.base_exchange' B₁ B₂ hB₁ hB₂ _ hx
lemma base.exchange_mem (hB₁ : M.base B₁) (hB₂ : M.base B₂) (hxB₁ : x ∈ B₁) (hxB₂ : x ∉ B₂) :
∃ y, (y ∈ B₂ ∧ y ∉ B₁) ∧ M.base (insert y (B₁ \ {x})) :=
by simpa using hB₁.exchange hB₂ ⟨hxB₁, hxB₂⟩
variables [finite E]
lemma base.card_eq_card_of_base (hB₁ : M.base B₁) (hB₂ : M.base B₂) :
B₁.ncard = B₂.ncard :=
begin
suffices h : ∀ i B B', M.base B → M.base B' → (B' \ B).ncard ≤ i →
B'.ncard ≤ B.ncard, from
(h _ _ _ hB₂ hB₁ rfl.le).antisymm (h _ _ _ hB₁ hB₂ rfl.le),
clear hB₁ B₁ hB₂ B₂,
intro i,
induction i with i IH,
{ rintros B B' - - h,
rw [le_zero_iff, ncard_eq_zero, diff_eq_empty] at h,
exact ncard_le_of_subset h, },
refine λ B B' hB hB' hcard, le_of_not_lt (λ hlt, _ ) ,
obtain ⟨x, hxB', hxB⟩ := exists_mem_not_mem_of_ncard_lt_ncard hlt,
have := hB'.exchange hB ⟨hxB',hxB⟩,
obtain ⟨y, hy, hB''⟩ := hB'.exchange hB ⟨hxB',hxB⟩,
have hcard := IH B (insert y (B' \ {x})) hB (by simpa using hB'') _,
{ apply hlt.not_le,
rwa [ncard_insert_of_not_mem, ncard_diff_singleton_add_one hxB'] at hcard,
simpa using hy.2},
suffices hss : (insert y (B' \ {x})) \ B ⊂ B' \ B,
{ exact nat.le_of_lt_succ ((ncard_lt_ncard hss).trans_le hcard)},
refine (ssubset_iff_of_subset (λ a, _) ).mpr ⟨x, _⟩,
{ rw [mem_diff, mem_insert_iff, and_imp, mem_diff_singleton],
rintro (rfl | ⟨haB',hax⟩) haB,
{ exact (haB hy.1).elim},
exact ⟨haB',haB⟩},
rw [exists_prop, mem_diff, mem_diff, not_and, not_not_mem, mem_insert_iff, mem_diff,
mem_singleton_iff, ne_self_iff_false, and_false, or_false],
exact ⟨⟨hxB', hxB⟩, by {rintro rfl, exact hy.1}⟩,
end
lemma base.eq_of_subset_base (hB₁ : M.base B₁) (hB₂ : M.base B₂) (hB₁B₂ : B₁ ⊆ B₂) :
B₁ = B₂ :=
begin
suffices : B₂ \ B₁ = ∅, from hB₁B₂.antisymm (diff_eq_empty.mp this),
by_contra' h,
obtain ⟨e,he⟩ := set.nonempty_iff_ne_empty.mpr h,
obtain ⟨y,hy,-⟩:= hB₂.exchange hB₁ he,
exact hy.2 (hB₁B₂ hy.1),
end
end base
end matroid
-- TODO : prove strong basis exchange (and hence define duality) in this file.
-- lemma base.indep (hB : M.base B) :
-- M.indep B :=
-- sorry
-- lemma base.insert_dep (hB : M.base B) (h : e ∉ B) :
-- ¬M.indep (insert e B) := sorry
-- lemma base_iff_maximal_indep :
-- M.base B ↔ M.indep B ∧ ∀ I, M.indep I → B ⊆ I → B = I :=
-- sorry
-- lemma indep.unique_circuit_of_insert {e : E} (hI : M.indep I) (hI' : ¬M.indep (insert e I)) :
-- ∃! C, C ⊆ insert e I ∧ M.circuit C ∧ e ∈ C := sorry
-- lemma subset_cl (M : matroid E) (X : set E) :
-- X ⊆ M.cl X := sorry
-- -- lemma base_iff_indep_card :
-- -- M.base B ↔ M.indep B ∧ B.ncard =
|
module Data.DPair
%default total
namespace Exists
||| A dependent pair in which the first field (witness) should be
||| erased at runtime.
|||
||| We can use `Exists` to construct dependent types in which the
||| type-level value is erased at runtime but used at compile time.
||| This type-level value could represent, for instance, a value
||| required for an intrinsic invariant required as part of the
||| dependent type's representation.
|||
||| @type The type of the type-level value in the proof.
||| @this The dependent type that requires an instance of `type`.
public export
data Exists : (this : type -> Type) -> Type where
Evidence : (0 value : type)
-> (prf : this value)
-> Exists this
||| Return the type-level value (evidence) required by the dependent type.
|||
||| We need to be in the Erased setting for this to work.
|||
||| @type The type-level value's type.
||| @pred The dependent type that requires an instance of `type`.
||| @prf That there is a value that satisfies `prf`.
public export
0
fst : {0 type : Type}
-> {0 pred : type -> Type}
-> (1 prf : Exists pred)
-> type
fst (Evidence value _) = value
||| Return the dependently typed value.
|||
||| @type The type-level value's type.
||| @pred The dependent type that requires an instance of `type`.
||| @prf That there is a value that satisfies `prf`.
public export
snd : {0 type : Type}
-> {0 pred : type -> Type}
-> (1 prf : Exists pred)
-> pred (Exists.fst prf)
snd (Evidence value prf) = prf
namespace Subset
||| A dependent pair in which the second field (evidence) should not
||| be required at runtime.
|||
||| We can use `Subset` to provide extrinsic invariants about a
||| value and know that these invariants are erased at
||| runtime but used at compile time.
|||
||| @type The type-level value's type.
||| @pred The dependent type that requires an instance of `type`.
public export
data Subset : (type : Type)
-> (pred : type -> Type)
-> Type
where
Element : (value : type)
-> (0 prf : pred value)
-> Subset type pred
||| Return the type-level value (evidence) required by the dependent type.
|||
||| @type The type-level value's type.
||| @pred The dependent type that requires an instance of `type`.
||| @prf That there is a value that satisfies `prf`.
public export
fst : {0 type : Type}
-> {0 pred : type -> Type}
-> (1 prf : Subset type pred)
-> type
fst (Element value prf) = value
||| Return the dependently typed value.
|||
||| We need to be in the erased setting for this to work.
|||
||| @type The type-level value's type.
||| @pred The dependent type that requires an instance of `type`.
||| @prf That there is a value that satisfies `prf`.
public export
0
snd : {0 type : Type}
-> {0 pred : type -> Type}
-> (1 value : Subset type pred)
-> pred (Subset.fst value)
snd (Element value prf) = prf
|
```python
%matplotlib inline
%load_ext autoreload
%autoreload 2
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import numpy as np
import scipy as sp
import scipy.stats
import time
import yaml
try:
from yaml import CLoader as Loader
except ImportError:
from yaml import Loader
from pydrake.all import (RigidBodyTree, RigidBody)
```
The autoreload extension is already loaded. To reload it, use:
%reload_ext autoreload
```python
DATA_FILE = "data/20180626_uniform_feasible_1000.yaml"
with open(DATA_FILE, "r") as f:
environments = yaml.load(f, Loader=Loader)
N_ENVIRONMENTS = len(environments.keys())
print("Loaded %d environments from file %s" % (N_ENVIRONMENTS, DATA_FILE))
```
Loaded 1000 environments from file data/20180626_uniform_feasible_1000.yaml
```python
# Make a listing of the observed classes
class_name_to_index_map = {}
class_index_to_name_map = []
current_ind = 0
for env_name in environments.keys():
env = environments[env_name]
for k in range(env["n_objects"]):
class_name = env["obj_%04d" % k]["class"]
if class_name not in class_name_to_index_map:
class_name_to_index_map[class_name] = current_ind
class_index_to_name_map.append(class_name)
current_ind += 1
print class_name_to_index_map, class_index_to_name_map
N_CLASSES = current_ind
```
{'small_box': 0} ['small_box']
```python
# Draw a few example scenes from the set
import generate_planar_scene_arrangements as psa_utils
def draw_environment(environment, ax):
rbt, q = psa_utils.build_rbt_from_summary(environment)
psa_utils.draw_board_state(ax, rbt, q)
patch = patches.Rectangle([0., 0.], 1., 1., fill=True, color=[0., 1., 0.],
linestyle='solid', linewidth=2, alpha=0.3)
ax.add_patch(patch)
plt.figure().set_size_inches(12, 12)
print "Selection of environments from original distribution"
N = 5
for i in range(N):
for j in range(N):
plt.subplot(N, N, i*N+j+1)
draw_environment(environments["env_%04d" % (i*N+j)], plt.gca())
plt.grid(True)
plt.tight_layout()
```
## Fitting distributions to generated scene data
Referencing discussion from the 20180621 notebook -- one way to tackle this would be to treat each object as occuring independently of other objects. That is, we're ultimately interested in sampling a number of objects $n$, a set of object classes $c_i$, and a set of object poses $p_i$ $\{[c_0, p_0], ..., [c_n, p_n]\}$. They have joint distribution $p(n, c, p)$, which we factorize $p(n)\Pi_i\left[p(p_i | c_i)p(c_i)\right]$ -- that is, draw the number of objects and class of each object independently, and then draw each object pose independently based on a class-specific distribution.
So the distributions we need to fit are:
- The distribution of object number $p(n)$, which we'll just draw up a histogram
- The distribution of individual object class $p(c_i)$, which we'll also just draw up a histogram
- The distribution of object pose based on class $p(p_i | c_i)$, which we'll fit with KDE
```python
# Get statistics for # object occurance rate and classes
object_number_occurances = np.zeros(N_ENVIRONMENTS)
object_class_occurances = np.zeros(N_CLASSES)
for i in range(N_ENVIRONMENTS):
env = environments["env_%04d" % i]
object_number_occurances[i] = env["n_objects"]
for k in range(env["n_objects"]):
object_class_occurances[
class_name_to_index_map[env["obj_%04d" % k]["class"]]] += 1
n_hist, n_hist_bins = np.histogram(object_number_occurances,
bins=range(int(np.ceil(np.max(object_number_occurances)))+2))
n_pdf = n_hist.astype(np.float64)/np.sum(n_hist)
plt.subplot(2, 1, 1)
plt.bar(n_hist_bins[:-1], n_pdf, align="edge")
plt.xlabel("# objects")
plt.ylabel("occurance rate")
plt.subplot(2, 1, 2)
class_pdf = object_class_occurances / np.sum(object_class_occurances)
plt.bar(range(N_CLASSES), class_pdf, align="edge")
plt.xlabel("object class")
plt.ylabel("occurance rate")
plt.tight_layout()
```
```python
# Build statistics for object poses per each object class
object_poses_per_class = []
# Useful to have for preallocating occurance vectors
max_num_objects_in_any_environment = int(np.max(object_number_occurances))
for class_k in range(N_CLASSES):
# Overallocate, we'll resize when we're done
poses = np.zeros((3, max_num_objects_in_any_environment*N_ENVIRONMENTS))
total_num_objects = 0
for i in range(N_ENVIRONMENTS):
env = environments["env_%04d" % i]
for k in range(env["n_objects"]):
obj = env["obj_%04d" % k]
if class_name_to_index_map[obj["class"]] == class_k:
poses[:, total_num_objects] = obj["pose"][:]
total_num_objects += 1
object_poses_per_class.append(poses[:, :total_num_objects])
class_kde_fits = []
tslices = np.linspace(0., 2*np.pi, 8, endpoint=False)
plt.figure().set_size_inches(16, 8)
plt.title("Distribution over space, per object class")
for class_k in range(N_CLASSES):
print("Computing KDE for class %d" % class_k)
poses = object_poses_per_class[class_k]
kde_fit = sp.stats.gaussian_kde(poses)
class_kde_fits.append(kde_fit)
for slice_k, tslice in enumerate(tslices):
xmin = -0.25
xmax = 1.25
ymin = -0.25
ymax = 1.25
N = 100j
X, Y = np.mgrid[xmin:xmax:N, ymin:ymax:N]
positions = np.vstack([X.ravel(), Y.ravel(), np.zeros(X.ravel().shape) + tslice])
Z = np.reshape(kde_fit(positions).T, X.shape)
print "Class %d, Theta=%f, Max Likelihood Anywhere: %f" %(class_k, tslice, np.max(Z))
plt.subplot(N_CLASSES*2, 4, class_k+1 + slice_k)
plt.title("Class %d, Theta=%f" % (class_k, tslice))
plt.gca().imshow(np.rot90(Z[:, :]), vmin=0., vmax=1.,
cmap=plt.cm.gist_earth_r,
extent=[xmin, xmax, ymin, ymax])
plt.scatter(poses[0, :], poses[1, :], s=0.05, c=[1., 0., 1.])
plt.xlabel("x")
plt.ylabel("y")
plt.grid(True)
plt.tight_layout()
```
As expected, this fits the uniform distribution of classes over space pretty well, though it does have trouble dealing with the angle wraparound (observe that the likelihood drops off at theta=0 to almost half of what it is elsewhere). Not too surprising, as that's on the "border" of the observed samples. Would have to use a specialized KDE tool to handle that down the road.
## Sampling new scenes from this data
We can generate new scenes by sampling up the dependency tree:
1) First sample # of objects
2) Then sample a class for every object, independently
3) Given each object's class, sample its location
We can also evaluate the likelihood of each generated sample
to get an idea how "typical" they are, by finding the likelihood
of each object given its generated position and class and combining
them. However, we have to normalize by the maximum possible likelihood
for an object of that class for every object for the comparison between
two sets of objects to make sense.
```python
n_cdf = np.cumsum(n_pdf)
class_cdf = np.cumsum(class_pdf)
# Calculate maximum likelihood value for each class
classwise_max_likelihoods = np.zeros(N_CLASSES)
for i in range(N_CLASSES):
# Evaluate the PDF at a bunch of sample points
xmin = 0.
xmax = 1.
ymin = 0.
ymax = 1.
tmin = 0.
tmax = 2.*np.pi
N = 20j
X, Y, T = np.mgrid[xmin:xmax:N, ymin:ymax:N, tmin:tmax:N]
positions = np.vstack([X.ravel(), Y.ravel(), T.ravel()])
classwise_max_likelihoods[i] = (np.max(class_kde_fits[i](positions)))
print "Classwise max likelihoods: ", classwise_max_likelihoods
plt.figure().set_size_inches(12, 12)
plt.title("Generated environments matching original distribution")
np.random.seed(42)
N = 5
for i in range(N):
for j in range(N):
total_log_likelihood = 0.
n_objects = np.argmax(n_cdf >= np.random.random())
total_log_likelihood += np.log(n_pdf[n_objects])
environment = {"n_objects": n_objects}
lln = 0
for object_k in range(n_objects):
obj_name = "obj_%04d" % object_k
obj_class = np.argmax(class_cdf >= np.random.random())
total_log_likelihood += np.log(class_pdf[obj_class] / np.max(class_pdf))
obj_pose = class_kde_fits[obj_class].resample([1])
total_log_likelihood += (class_kde_fits[obj_class].logpdf(obj_pose) -
np.log(classwise_max_likelihoods[obj_class]))
environment[obj_name] = {"pose": obj_pose,
"class": class_index_to_name_map[obj_class]}
plt.subplot(N, N, i*N+j+1)
draw_environment(environment, plt.gca())
plt.grid(True)
plt.title("LL: %f" % total_log_likelihood)
plt.xlim(-0.25, 1.25)
plt.ylim(-0.25, 1.25)
print "TODO: Log likelihood is still probably wrong... the scaling with N is weird."
plt.tight_layout()
```
As in the previous notebook for truly independent objects, I attempt to calculate log likelihood scores for each arrangement by calculating
$$ p(c, p, n) = p(n) * {\Large \Pi_{i}^{n}} \left[ \dfrac{p(p_i | c_i)}{\max_{\hat{p}}{p(\hat{p} | c_i})} \dfrac{p(c_i)}{\max_{\hat{c}} p(c)} \right] $$
(which includes normalization on a per-object and per-class basis to make comparison between scenes with different N possible). But I'm not convinced this is right, yet...
This clearly violates collision constraints, though, and would be hopeless to capture other inter-object interactions. Nonpenetration itself is an inter-object interaction, and should be handled as such.
## Investigating inter-object interactions
Let's refactorize a bit more carefully, instead breaking down $p(p, c)$ into a combination of pairwise terms.
$$ \begin{align}
p(c, p, n) &= p(n) * \Pi_{ (i, j) \in [0...N]\times[0...N]} \left[ p(p_i, p_j, c_i, c_j) \right] \\
&= p(n) * \Pi_{ (i, j) \in [0...N]\times[0...N]} \left[ p(p_i - p_j | p_j, c_i, c_j) p(p_j | c_i, c_j) p(c_j | c_i) p(c_i) \right] \\
&= p(n) * \Pi_{ (i, j) \in [0...N]\times[0...N]} \left[ p(p_i - p_j | c_i, c_j) p(p_j | c_i, c_j) p(c_j | c_i) p(c_i) \right]
\end{align} $$
Here $p(p_i - p_j | c_i, c_j)$ describes the probability of the $i^{th}$ object being in various locations relative to a $j^{th}$ object, given both of their classes. This is assumed to be *independent* of the location of the $j^{th}$ object, for tractibility. We account for the position of the $j^{th}$ object with the distribution $p(p_j | c_i, c_j)$, which encodes what places the $j^{th}$ object is likely to be given that it's of class $c_j$ and will be
|
[STATEMENT]
lemma ns_mul_ext_trans:
assumes "trans s" "trans ns" "compatible_l ns s" "compatible_r ns s" "refl ns"
and "(A, B) \<in> ns_mul_ext ns s"
and "(B, C) \<in> ns_mul_ext ns s"
shows "(A, C) \<in> ns_mul_ext ns s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (A, C) \<in> ns_mul_ext ns s
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
trans s
trans ns
compatible_l ns s
compatible_r ns s
refl ns
(A, B) \<in> ns_mul_ext ns s
(B, C) \<in> ns_mul_ext ns s
goal (1 subgoal):
1. (A, C) \<in> ns_mul_ext ns s
[PROOF STEP]
unfolding compatible_l_def compatible_r_def ns_mul_ext_def
[PROOF STATE]
proof (prove)
using this:
trans s
trans ns
ns O s \<subseteq> s
s O ns \<subseteq> s
refl ns
(A, B) \<in> (mult2_alt_ns (ns\<inverse>) (s\<inverse>))\<inverse>
(B, C) \<in> (mult2_alt_ns (ns\<inverse>) (s\<inverse>))\<inverse>
goal (1 subgoal):
1. (A, C) \<in> (mult2_alt_ns (ns\<inverse>) (s\<inverse>))\<inverse>
[PROOF STEP]
using trans_mult2_ns[of "s\<inverse>" "ns\<inverse>"]
[PROOF STATE]
proof (prove)
using this:
trans s
trans ns
ns O s \<subseteq> s
s O ns \<subseteq> s
refl ns
(A, B) \<in> (mult2_alt_ns (ns\<inverse>) (s\<inverse>))\<inverse>
(B, C) \<in> (mult2_alt_ns (ns\<inverse>) (s\<inverse>))\<inverse>
\<lbrakk>s\<inverse> O ns\<inverse> \<subseteq> s\<inverse>; refl (ns\<inverse>); trans (ns\<inverse>)\<rbrakk> \<Longrightarrow> trans (mult2_ns (ns\<inverse>) (s\<inverse>))
goal (1 subgoal):
1. (A, C) \<in> (mult2_alt_ns (ns\<inverse>) (s\<inverse>))\<inverse>
[PROOF STEP]
by (auto simp: mult2_ns_eq_mult2_ns_alt converse_relcomp[symmetric]) (metis trans_def) |
library(GEOquery)
library(ggplot2)
# get the data from GEO ( GSE matrix & annotation GPL)
# define destination to save data, SO didn't need load data each time
series = "GSE34670"
platform = "GPL96"
gset = getGEO(series, GSEMatrix =TRUE, AnnotGPL=TRUE, destdir = "Data/")
# if the data have several platforms, choose the certain platform
if (length(gset) > 1) idx <- grep(platform, attr(gset, "names")) else idx <- 1
gset = gset[[idx]]
# define groups for samples
gr = c(rep("cALL_BM", 5) , "cALL_PB" ,rep("cALL_BM", 19), "CL_cALL2" , "CL_697" , "CL_NALM6" , rep("CD10", 6), rep("CD10_pool" , 3) )
# elicit expression matrix from data
ex = exprs(gset)
# log2 transformation
ex = log2(ex + 1 )
exprs(gset) = ex
# principal component analysis (PCA)
# PCA for genes & plot it
pc = prcomp(ex)
pdf("Results/pc.pdf")
plot(pc)
plot(pc$x[,1:2])
dev.off()
# zero mean normalization & compute PCA & plot it
ex.scale = t(scale(t(ex), scale = F))
pc = prcomp(ex.scale)
pdf("Results/pc_scaled.pdf")
plot(pc)
plot(pc$x[,1:2])
dev.off()
# PCA for samples & plot it
pcr = data.frame(pc$r[,1:3], Group=gr)
pdf("Results/PCA_SAmples.pdf")
ggplot(pcr, aes(PC1, PC2, color=Group)) + geom_point(size=3) + theme_bw()
dev.off()
|
How to move data from samsung galaxy to computer?
Lost Data from Your Phone? Get Them Back Now!
[SOLVED] How to Recover Deleted and Lost Data from Samsung Galaxy Note 8?
How to Recover Deleted Data from Samsung Galaxy S9?
[SOLVED] How to Transfer Data from Android to Android Quickly?
How to Recover Deleted Messages from Samsung Galaxy S7?
[SOLVED] How to recover deleted contacts from huawei p20 pro?
How to Recover Contacts from Broken Samsung Galaxy Phone?
[SOLVED] How to Transfer Data from Android to Xiaomi Mi MIX 2? |
use DocumentTools in
if parse(GetProperty("ComputeId", value)) then
SetProperty("bypass", enabled, true):
SetProperty("SkipSingle", enabled, true):
SetProperty("SimplifiedGen", enabled, true):
SetProperty("NoBound", enabled, true):
SetProperty("Refine", enabled, true):
else
SetProperty("bypass", enabled, false):
SetProperty("SkipSingle", enabled, false):
SetProperty("SimplifiedGen", enabled, false):
SetProperty("NoBound", enabled, false):
SetProperty("Refine", enabled, false):
SetProperty("UsingUpTo", enabled, false):
SetProperty("MaxPermutations", enabled, false):
SetProperty("Permutations", enabled, false):
fi:
end use; |
//
// Copyright (c) 2019 Vinnie Falco ([email protected])
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Official repository: https://github.com/vinniefalco/url
//
#ifndef BOOST_URL_HPP
#define BOOST_URL_HPP
#include <boost/url/config.hpp>
#include <boost/url/url_base.hpp>
#include <boost/url/error.hpp>
#include <boost/url/host_type.hpp>
#include <boost/url/scheme.hpp>
#include <boost/url/static_pool.hpp>
#include <boost/url/url_view.hpp>
#include <boost/url/urls.hpp>
#endif
|
/-
Copyright (c) 2018 Sébastien Gouëzel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Sébastien Gouëzel
-/
import analysis.normed_space.lp_space
import topology.compacts
/-!
# The Kuratowski embedding
Any separable metric space can be embedded isometrically in `ℓ^∞(ℝ)`.
-/
noncomputable theory
open set metric topological_space
open_locale ennreal
local notation `ℓ_infty_ℝ`:= lp (λ n : ℕ, ℝ) ∞
universes u v w
variables {α : Type u} {β : Type v} {γ : Type w}
namespace Kuratowski_embedding
/-! ### Any separable metric space can be embedded isometrically in ℓ^∞(ℝ) -/
variables {f g : ℓ_infty_ℝ} {n : ℕ} {C : ℝ} [metric_space α] (x : ℕ → α) (a b : α)
/-- A metric space can be embedded in `l^∞(ℝ)` via the distances to points in
a fixed countable set, if this set is dense. This map is given in `Kuratowski_embedding`,
without density assumptions. -/
def embedding_of_subset : ℓ_infty_ℝ :=
⟨ λ n, dist a (x n) - dist (x 0) (x n),
begin
apply mem_ℓp_infty,
use dist a (x 0),
rintros - ⟨n, rfl⟩,
exact abs_dist_sub_le _ _ _
end ⟩
lemma embedding_of_subset_coe : embedding_of_subset x a n = dist a (x n) - dist (x 0) (x n) := rfl
/-- The embedding map is always a semi-contraction. -/
lemma embedding_of_subset_dist_le (a b : α) :
dist (embedding_of_subset x a) (embedding_of_subset x b) ≤ dist a b :=
begin
refine lp.norm_le_of_forall_le dist_nonneg (λn, _),
simp only [lp.coe_fn_sub, pi.sub_apply, embedding_of_subset_coe, real.dist_eq],
convert abs_dist_sub_le a b (x n) using 2,
ring
end
/-- When the reference set is dense, the embedding map is an isometry on its image. -/
lemma embedding_of_subset_isometry (H : dense_range x) : isometry (embedding_of_subset x) :=
begin
refine isometry_emetric_iff_metric.2 (λa b, _),
refine (embedding_of_subset_dist_le x a b).antisymm (le_of_forall_pos_le_add (λe epos, _)),
/- First step: find n with dist a (x n) < e -/
rcases metric.mem_closure_range_iff.1 (H a) (e/2) (half_pos epos) with ⟨n, hn⟩,
/- Second step: use the norm control at index n to conclude -/
have C : dist b (x n) - dist a (x n) = embedding_of_subset x b n - embedding_of_subset x a n :=
by { simp only [embedding_of_subset_coe, sub_sub_sub_cancel_right] },
have := calc
dist a b ≤ dist a (x n) + dist (x n) b : dist_triangle _ _ _
... = 2 * dist a (x n) + (dist b (x n) - dist a (x n)) : by { simp [dist_comm], ring }
... ≤ 2 * dist a (x n) + |dist b (x n) - dist a (x n)| :
by apply_rules [add_le_add_left, le_abs_self]
... ≤ 2 * (e/2) + |embedding_of_subset x b n - embedding_of_subset x a n| :
begin rw C, apply_rules [add_le_add, mul_le_mul_of_nonneg_left, hn.le, le_refl], norm_num end
... ≤ 2 * (e/2) + dist (embedding_of_subset x b) (embedding_of_subset x a) :
begin
have : |embedding_of_subset x b n - embedding_of_subset x a n|
≤ dist (embedding_of_subset x b) (embedding_of_subset x a),
{ simpa [dist_eq_norm] using lp.norm_apply_le_norm ennreal.top_ne_zero
(embedding_of_subset x b - embedding_of_subset x a) n },
nlinarith,
end
... = dist (embedding_of_subset x b) (embedding_of_subset x a) + e : by ring,
simpa [dist_comm] using this
end
/-- Every separable metric space embeds isometrically in `ℓ_infty_ℝ`. -/
theorem exists_isometric_embedding (α : Type u) [metric_space α] [separable_space α] :
∃(f : α → ℓ_infty_ℝ), isometry f :=
begin
cases (univ : set α).eq_empty_or_nonempty with h h,
{ use (λ_, 0), assume x, exact absurd h (nonempty.ne_empty ⟨x, mem_univ x⟩) },
{ /- We construct a map x : ℕ → α with dense image -/
rcases h with ⟨basepoint⟩,
haveI : inhabited α := ⟨basepoint⟩,
have : ∃s:set α, countable s ∧ dense s := exists_countable_dense α,
rcases this with ⟨S, ⟨S_countable, S_dense⟩⟩,
rcases countable_iff_exists_surjective.1 S_countable with ⟨x, x_range⟩,
/- Use embedding_of_subset to construct the desired isometry -/
exact ⟨embedding_of_subset x, embedding_of_subset_isometry x (S_dense.mono x_range)⟩ }
end
end Kuratowski_embedding
open topological_space Kuratowski_embedding
/-- The Kuratowski embedding is an isometric embedding of a separable metric space in `ℓ^∞(ℝ)`. -/
def Kuratowski_embedding (α : Type u) [metric_space α] [separable_space α] : α → ℓ_infty_ℝ :=
classical.some (Kuratowski_embedding.exists_isometric_embedding α)
/-- The Kuratowski embedding is an isometry. -/
protected lemma Kuratowski_embedding.isometry (α : Type u) [metric_space α] [separable_space α] :
isometry (Kuratowski_embedding α) :=
classical.some_spec (exists_isometric_embedding α)
/-- Version of the Kuratowski embedding for nonempty compacts -/
def nonempty_compacts.Kuratowski_embedding (α : Type u) [metric_space α] [compact_space α]
[nonempty α] :
nonempty_compacts ℓ_infty_ℝ :=
⟨range (Kuratowski_embedding α), range_nonempty _,
is_compact_range (Kuratowski_embedding.isometry α).continuous⟩
|
[STATEMENT]
lemma distinct_conv_pairs: "distinct xs \<longleftrightarrow> list_all (\<lambda>(x,y). x \<noteq> y) (pairs xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. distinct xs = list_all (\<lambda>(x, y). x \<noteq> y) (pairs xs)
[PROOF STEP]
by (induction xs) (auto simp: list_all_iff) |
-- Andreas, 2016-07-28, issue #779
data D : Set where c : D
record R : Set1 where
bla : D → D
bla c = c
field F : Set
-- Current:
-- Not a valid let-definition
-- Expected:
-- Success, or error outlawing pattern matching definition before last field.
|
function x= BesseliRatio(nu,kappa,maxIter)
%%BESSELIRATIO Evaluate the ratio of modified Bessel functions of the first
% kind of the form x=I_{nu}(kappa)/I_{nu-1}(kappa).
%
%INPUTS: nu The positive integer (upper) order of the modified Bessel
% function of the first kind in the ratio; nu>=1.
% kappa The real argument of the modified Bessel function of the first
% kind; kappa>=0.
% maxIter An optional parameter specifying the maximum number of
% iterations to use for computing the ratio using an iterative
% method. If this parameter is omitted or an empty matrix is
% passed, the default value of 2000 is used. Convergence usually
% occurs long before the maximum number of iterations is reached.
%
%OUTPUTS: x The value of the ratio I_{nu}(kappa)/I_{nu-1}(kappa).
%
%Numerical precision limitations can make the evaluation of Bessel function
%radios difficult if one tries to explicitly evaluate the functions. Here,
%the algorithm of Perron described in [1] is implemented.
%
%REFERENCES:
%[1] W. Gautschi and J. Slavik, "On the computation of modified Bessel
% function ratios," Mathematics of Computation, vol. 32, no. 143, pp.
% 865-875, Jul. 1978.
%
%September 2013 David F. Crouse, Naval Research Laboratory, Washington D.C.
%(UNCLASSIFIED) DISTRIBUTION STATEMENT A. Approved for public release.
if(nargin<3||isempty(maxIter))
%It usually converges long before the maximum number of iterations.
maxIterations=2000;
end
%tolerance for convergence. This should be suitable for double-
%precision computations.
tol=1e-15;
k=1;
cumProd=1;
pCur=0.5*kappa*(nu+0.5)/((nu+kappa/2)*(nu+kappa+0.5)-0.5*kappa*(nu+0.5));
cumProd=cumProd*pCur;
cumSum=1+cumProd;
while(k<maxIterations)
pPrev=pCur;
k=k+1;
pCur=0.5*kappa*(nu+k-0.5)*(1+pPrev)/((nu+kappa+(k-1)/2)*(nu+kappa+k/2)-0.5*kappa*(nu+k-0.5)*(1+pPrev));
cumProd=cumProd*pCur;
cumSumNew=cumSum+cumProd;
%If we have hit a precision limit; this usually happens before k
%gets too big.
if(abs(cumSumNew-cumSum)<tol)
break;
end
cumSum=cumSumNew;
end
a0=(kappa+2*nu)/kappa;
x=cumSum/a0;
end
%LICENSE:
%
%The source code is in the public domain and not licensed or under
%copyright. The information and software may be used freely by the public.
%As required by 17 U.S.C. 403, third parties producing copyrighted works
%consisting predominantly of the material produced by U.S. government
%agencies must provide notice with such work(s) identifying the U.S.
%Government material incorporated and stating that such material is not
%subject to copyright protection.
%
%Derived works shall not identify themselves in a manner that implies an
%endorsement by or an affiliation with the Naval Research Laboratory.
%
%RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF THE
%SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY THE NAVAL
%RESEARCH LABORATORY FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE ACTIONS
%OF RECIPIENT IN THE USE OF THE SOFTWARE.
|
[STATEMENT]
lemma c_insert_is_pr: "c_insert \<in> PrimRec2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. c_insert \<in> PrimRec2
[PROOF STEP]
proof (unfold c_insert_def, rule if_eq_is_pr2)
[PROOF STATE]
proof (state)
goal (4 subgoals):
1. c_in \<in> PrimRec2
2. (\<lambda>x y. 1) \<in> PrimRec2
3. (\<lambda>x y. y) \<in> PrimRec2
4. (\<lambda>x y. y + 2 ^ x) \<in> PrimRec2
[PROOF STEP]
show "c_in \<in> PrimRec2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. c_in \<in> PrimRec2
[PROOF STEP]
by (rule c_in_is_pr)
[PROOF STATE]
proof (state)
this:
c_in \<in> PrimRec2
goal (3 subgoals):
1. (\<lambda>x y. 1) \<in> PrimRec2
2. (\<lambda>x y. y) \<in> PrimRec2
3. (\<lambda>x y. y + 2 ^ x) \<in> PrimRec2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
1. (\<lambda>x y. 1) \<in> PrimRec2
2. (\<lambda>x y. y) \<in> PrimRec2
3. (\<lambda>x y. y + 2 ^ x) \<in> PrimRec2
[PROOF STEP]
show "(\<lambda>x y. 1) \<in> PrimRec2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<lambda>x y. 1) \<in> PrimRec2
[PROOF STEP]
by (rule const_is_pr_2)
[PROOF STATE]
proof (state)
this:
(\<lambda>x y. 1) \<in> PrimRec2
goal (2 subgoals):
1. (\<lambda>x y. y) \<in> PrimRec2
2. (\<lambda>x y. y + 2 ^ x) \<in> PrimRec2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. (\<lambda>x y. y) \<in> PrimRec2
2. (\<lambda>x y. y + 2 ^ x) \<in> PrimRec2
[PROOF STEP]
show "(\<lambda>x y. y) \<in> PrimRec2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<lambda>x y. y) \<in> PrimRec2
[PROOF STEP]
by (rule pr_id2_2)
[PROOF STATE]
proof (state)
this:
(\<lambda>x y. y) \<in> PrimRec2
goal (1 subgoal):
1. (\<lambda>x y. y + 2 ^ x) \<in> PrimRec2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. (\<lambda>x y. y + 2 ^ x) \<in> PrimRec2
[PROOF STEP]
from power_is_pr
[PROOF STATE]
proof (chain)
picking this:
(^) \<in> PrimRec2
[PROOF STEP]
show "(\<lambda>x y. y + 2 ^ x) \<in> PrimRec2"
[PROOF STATE]
proof (prove)
using this:
(^) \<in> PrimRec2
goal (1 subgoal):
1. (\<lambda>x y. y + 2 ^ x) \<in> PrimRec2
[PROOF STEP]
by prec
[PROOF STATE]
proof (state)
this:
(\<lambda>x y. y + 2 ^ x) \<in> PrimRec2
goal:
No subgoals!
[PROOF STEP]
qed |
He authored the section entitled " Ancient India " for Piggott 's edited volume The Dawn of Civilisation , which was published by Thames and Hudson in 1961 , before writing an introduction for Roger Wood 's photography book Roman Africa in Colour , which was also published by Thames and Hudson . He then agreed to edit a series for the publisher , known as " New Aspects of Antiquity " , through which they released a variety of archaeological works . The rival publisher Weidenfeld & Nicolson had also persuaded Wheeler to work for them , securing him to write many sections of their book , <unk> of the East . They also published his 1968 book Flames Over Persopolis , in which Wheeler discussed Persopolis and the Persian Empire in the year that it was conquered by Alexander the Great .
|
{-# OPTIONS --cubical --safe #-}
open import Algebra
module Control.Monad.Weighted {ℓ} (rng : Semiring ℓ) where
open import Control.Monad.Weighted.Definition rng public
open import Control.Monad.Weighted.Union rng using (_∪_) public
open import Control.Monad.Weighted.Cond rng using (_⋊_) public
open import Control.Monad.Weighted.Monad rng using (_>>=_; pure; _>>_; _<*>_) public
import Control.Monad.Weighted.Expect using (∫)
module Expect = Control.Monad.Weighted.Expect rng
|
`is_element/E/Fbar` := (N::posint) -> (A::set,B::set) -> proc(tpqx)
global reason;
local t,p,q,x,nt,nx;
if not(type(tpqx,list) and nops(tpqx) = 4) then
reason := [convert(procname,string),"tpqx is not a list of length 4",tpqx];
return false;
fi;
t,p,q,x := op(tpqx);
if not (`is_element/real_functions`(A)(t) and
`is_nonnegative/real_functions`(A)(t)) then
reason := [convert(procname,string),"t is not a nonnegative real function on A",t,A];
return false;
fi;
nt := `norm/real_functions`(A)(t)^2;
if simplify(nt - 1) <> 0 then
reason := [convert(procname,string),"t is not in normalised",t];
return false;
fi;
if not(`is_element/RR`(p) and
`is_element/RR`(q) and
p >= 0 and q >= 0 and simplify(p^2+q^2 - 1) = 0) then
reason := [convert(procname,string),"(p,q) is not in normalised",p,q];
return false;
fi;
if not `is_element/prime_W`(N)(B)(x) then
reason := [convert(procname,string),"x is not in NWB",x,B,reason];
return false;
fi;
nx := `norm/prime_W`(N)(B)(x)^2;
if simplify(nx - 1) <> 0 then
reason := [convert(procname,string),"x is not in normalised",x];
return false;
fi;
return true;
end:
######################################################################
`random_element/E/Fbar` := (N::posint) -> (A::set,B::set) -> proc()
local t,p,q,x,n,t0,r,i,b;
n := nops(A);
t0 := map(abs,`random_element/sphere`(n-1)());
t := table([seq(A[i]=t0[i],i=1..n)]):
p,q := op(map(abs,`random_element/sphere`(1)()));
r := 0;
while r = 0 do
x := `random_element/prime_W`(N)(B)();
r := `norm/prime_W`(N)(B)(x);
od;
x := table([seq(b = simplify(x[b] /~ r),b in B)]);
return [eval(t),p,q,eval(x)];
end:
######################################################################
`is_equal/E/Fbar` := (N::posint) -> (A::set,B::set) -> proc(tpqx1,tpqx2)
local t1,p1,q1,x1,t2,p2,q2,x2;
t1,p1,q1,x1 := op(tpqx1);
t2,p2,q2,x2 := op(tpqx2);
return `is_equal/real_functions`(A)(t1,t2) and
`is_equal/RR`(p1,p2) and
`is_equal/RR`(q1,q2) and
`is_equal/prime_W`(N)(B)(x1,x2);
end:
######################################################################
`theta/E/D/Fbar` := (N::posint) -> (A::set,B::set) -> proc(tpqx)
local t,p,q,x,u,v,a,b;
t,p,q,x := op(tpqx);
u := table();
v := table();
for a in A do u[a] := p * t[a]; od;
for b in B do
v[b] := q *~ x[b];
od;
return [u,v];
end;
######################################################################
`is_leq/E/Fbar` := NULL:
`list_elements/E/Fbar` := NULL:
`count_elements/E/Fbar` := NULL:
|
lemma const_poly_dvd_iff_dvd_content: "[:c:] dvd p \<longleftrightarrow> c dvd content p" for c :: "'a::semiring_gcd" |
\documentclass[]{article}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\else % if luatex or xelatex
\ifxetex
\usepackage{mathspec}
\else
\usepackage{fontspec}
\fi
\defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
\fi
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
% use microtype if available
\IfFileExists{microtype.sty}{%
\usepackage{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\usepackage[unicode=true]{hyperref}
\hypersetup{
pdftitle={ ISOQuant 1.6 Help pages},
pdfauthor={Jörg Kuharev, Pedro Navarro and Stefan Tenzer},
pdfborder={0 0 0},
breaklinks=true}
\urlstyle{same} % don't use monospace font for urls
\usepackage{listings}
\usepackage{longtable,booktabs}
\usepackage{graphicx,grffile}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
}
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{5}
% Redefines (sub)paragraphs to behave more like sections
\ifx\paragraph\undefined\else
\let\oldparagraph\paragraph
\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
\fi
\ifx\subparagraph\undefined\else
\let\oldsubparagraph\subparagraph
\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
\fi
\usepackage[left=2cm,right=1.5cm,top=1.5cm,bottom=1.5cm]{geometry}
% \setlength{\parindent}{0.25in}
\setlength{\parskip}{0.4cm}
\pagestyle{plain}
\usepackage[utf8]{inputenc}
\lstset{literate=%
{Ö}{{\"O}}1
{Ä}{{\"A}}1
{Ü}{{\"U}}1
{ß}{{\ss}}1
{ü}{{\"u}}1
{ä}{{\"a}}1
{ö}{{\"o}}1
{~}{{\textasciitilde}}1
}
\renewcommand{\contentsname}{Table of contents}
\usepackage{color}
% \definecolor{bgColor}{rgb}{1,1,0.95}
% \pagecolor{bgColor}
\definecolor{middlegray}{rgb}{0.5,0.5,0.5}
\definecolor{lightgray}{rgb}{0.8,0.8,0.8}
\definecolor{orange}{rgb}{0.8,0.3,0.3}
\definecolor{yac}{rgb}{0.6,0.6,0.1}
% settings for lstlisting environment
\lstset{
basicstyle=\small\ttfamily,
keywordstyle=\bfseries\ttfamily\color{orange},
stringstyle=\color{black}\ttfamily,
commentstyle=\color{middlegray}\ttfamily,
emph={square},
emphstyle=\color{blue}\texttt,
emph={[2]root,base},
emphstyle={[2]\color{yac}\texttt},
showstringspaces=false,
flexiblecolumns=false,
tabsize=2,
% numbers=left,
% numberstyle=\tiny,
% numberblanklines=false,
% stepnumber=1,
% numbersep=10pt,
language=sh,
numbers=none,
frame=shadowbox,
xleftmargin=15pt,
backgroundcolor={\color{lightgray}},
texcl=\true,
extendedchars=\true
}
\renewcommand{\baselinestretch}{1.0}\normalsize
\title{\texttt{\vspace{4cm}}\\
ISOQuant 1.6\\
\textbf{Help pages}}
\author{Jörg Kuharev, Pedro Navarro and Stefan Tenzer}
\date{\today \thispagestyle{empty}\\
\textbf{NOTE:}\\
Some contents of this document are not\\
aligned with the current software version.\\
An update is coming soon \ldots{} \clearpage}
\begin{document}
\maketitle
{
\setcounter{tocdepth}{3}
\tableofcontents
}
\clearpage
\renewcommand{\baselinestretch}{1.0}
\normalsize
\section{Description}\label{description}
ISOQuant is an academically developed, integrated bioinformatics
pipeline for in-depth evaluation and statistical data analysis of
data-independent acquisition (MS\textsuperscript{E} and
IMS-MS\textsuperscript{E}) based label-free quantitative proteomics that
improves data reliability and quality by application of well-established
and novel analysis methods.
\subsection{About ISOQuant}\label{about-isoquant}
One of the main bottlenecks in the evaluation of label-free quantitative
proteomics experiments is the often cumbersome data export for in-depth
data evaluation and analysis. Data-independent, alternate scanning LC-MS
(MS\textsuperscript{E}/HDMS\textsuperscript{E}/UDMS\textsuperscript{E})
peptide fragmentation data can currently only be processed by Waters
PLGS software (and by recently introduced Progenesis QI for Proteomics
(Nonlineare Dynamics / Waters)).\\
PLGS performs absolute quantification only on a run-to-run level, it
does not afford absolute quantification of protein isoforms and
label-free relative quantification of peptides and proteins based on
clustered accurate mass-retention time pairs on a complete experiment
basis.\\
The bioinformatics pipeline ISOQuant directly accesses xml files from
the PLGS root folder and browses for relevant data from a label-free
Expression Analysis project (quantification analyses, sample
descriptions, search results) for fully automated import into a MySQL
database. EMRTs are subjected to multidimensional LOWESS-based intensity
normalization and annotated by matching exact masses and aligned
retention times of detected features with highest scoring peptide
identification data from associated workflows. Based on the annotated
cluster table, ISOQuant calculates absolute in-sample amounts with an
integrated protein isoform quantification method, utilizing average
intensities of proteotypic peptides for the partitioning of non-unique
peptide intensities between protein isoforms. All data is stored in a
local MySQL based database that can be queried directly by experienced
users.
\subsection{Citing ISOQuant}\label{citing-isoquant}
ISOQuant has been developed since 2009. We introduced the basic
principles of ISOQuant analysis to the community as part of a Nature
Methods articles 2014 (Distler et al. 2014).
\begin{lstlisting}
Distler, U., Kuharev, J., Navarro, P., Levin, Y., Schild, H., & Tenzer, S.
(2014). Drift time-specific collision energies enable deep-coverage
data-independent acquisition proteomics.
Nature Methods, 11(2), 167–170. http://doi.org/10.1038/nmeth.2767
\end{lstlisting}
Please cite the mentioned publication, when using ISOQuant to produce
publication data or referencing to ISOQuant in other context. Use the
following BibTeX code to import into the reference manager of your
choice:
\begin{lstlisting}
@article{distler_drift_2014,
title = {Drift time-specific collision energies enable
deep-coverage data-independent acquisition proteomics},
author = {Distler, Ute and Kuharev, Jörg and Navarro, Pedro
and Levin, Yishai and Schild, Hansjörg and Tenzer, Stefan},
journal = {Nature Methods},
volume = {11},
issn = {1548-7091},
url = {http://www.nature.com/nmeth/journal/v11/n2/full/nmeth.2767.html},
doi = {10.1038/nmeth.2767},
month = feb,
year = {2014},
pages = {167--170}
}
\end{lstlisting}
\clearpage
\subsection{ISOQuant workflow}\label{isoquant-workflow}
The data analysis workflow (see fig. \ref{pic:iqWorkflow}) consists of
raw data preprocessing using vendor software PLGS and the downstream
analysis using ISOQuant. In our data analysis workflow, PLGS is used for
the initial signal processing as well as for peptide and protein
identification. Before automatically importing PLGS results into a
relational database (MySQL), ISOQuant allows to change the structure of
underlying PLGS project and in this way to redesign the label-free
experiment. The ISOQuant data analysis workflow is composed of multiple
dedicated algorithms. At different stages of analysis, data is filtered
on peptide and protein level based on user defined criteria
(identification score and type, sequence length, replication rate, FDR
threshold, etc.) to ensure a constant level of high data quality for all
runs in the project. The retention time alignment procedure corrects
non-linear retention time distortions between LC-MS runs of the
experiment (Podwojski et al. 2009). To group corresponding features from
different runs of the experiment, exact mass and retention time pairs
(EMRT) extended by ion mobility values are evaluated using the density
based clustering algorithm DBSCAN (Ester et al. 1996). Resulting feature
clusters are annotated by evaluation of consent peptide identifications
and identification probabilities. The feature cluster annotation
approach transfers peptide identifications between runs and reduces
missing values increasing the reproducibility of data analysis.
Resolving ambiguous peptides-in-proteins networks, the protein homology
filtering algorithm reduces side effects of the protein inference
problem (Nesvizhskii and Aebersold 2005). The multi-dimensional feature
intensity normalization algorithm reduces the effects of technical
variance between independently acquired LC-MS runs of the experiment and
increases the reproducibility of quantification. Finally, ISOQuant uses
a derivative of the Top3 method (Silva et al. 2006) for the absolute
protein quantification and exports analysis results to multiple output
formats for subsequent interpretation. Alternatively to ISOQuant, the
commercial software Progenesis QI for proteomics (Nonlinear Dynamics /
Waters) or the freely available R-package synapter (Bond et al. 2013)
could also be used to analyze MS\textsuperscript{E} data. In a recent
study, we tested Progenesis QIP, synapter and ISOQuant for the
performance of protein identification and the label-free quantification
based on the analysis a complex metaproteome sample set (Kuharev et al.
2015).
\begin{figure}[htbp]
\centering
\includegraphics{pic/isoquant_workflow.png}
\caption{The workflow of ISOQuant analysis \label{pic:iqWorkflow}}
\end{figure}
\clearpage
\subsection{Known problems}\label{known-problems}
\begin{itemize}
\tightlist
\item
On some \textbf{Windows Vista} or \textbf{Window 7} machines ISOQuant
can not write its configuration file. In this case you have to execute
ISOQuant with administrative privileges or correct file system
permissions for ISOQuant installation folder. This is not an ISOQuant
issue, sometimes Windows messes up file system permissions by using
different and inconsistent user privileges at different time points.
\item
Analysis of high complexity datasets may take a while.
\item
Importing (and analyzing) large projects or runs of high complexity
may cause out of memory errors, make sure your PC has enough memory
and assign more Heap-Space to Java Virtual Machine for running
ISOQuant Application.
\item
ISOQuant may fail to import and process data if some PLGS project
files are broken.
\item
Running MySQL on Mac OSX machines significantly decreases the
performance of ISOQuant. This is a known problem of MySQL not of
ISOQuant. Use Windows or Linux machines and/or install MariaDB instead
of MySQL for better performance.
\end{itemize}
\clearpage
\section{Program requirements}\label{program-requirements}
ISOQuant will only work properly if the system for running ISOQuant
meets following requirements.
\begin{itemize}
\item
Operating System: Windows, Mac OS X or Linux
\item
PLGS root folder with projects containing processed
MS\textsuperscript{E}/HDMS\textsuperscript{E}/UDMS\textsuperscript{E}
data is accessible (tested PLGS versions: 2.3/2.4/2.5/3.0)
\item
at least 3GB RAM
\item
Java Runtime Environment version 1.6.0 (or newer) is installed and
works properly
\item
MySQL Server 5.1 (or newer) is installed and running on local machine
or network. (tested MySQL versions: 5.1 - 5.5)
\item
MySQL configuration file options for heap and temporary tables have
large values as shown in following listing. In some cases it may be
useful also to increase the size of MySQL thread stack.
\begin{lstlisting}
max_heap_table_size = 2048M
tmp_table_size = 2048M
thread_stack = 256K
\end{lstlisting}
Depending on your operating system and MySQL-Version the configuration
file is named either my.ini or my.cnf and its location may vary.
Following listing shows an example of MySQL configuration section
{[}mysqld{]} working for us on MacOSX 10.6.8 Snow Leopard running
MySQL Server from XAMPP 1.7.3, the configuration file is located in
\lstinline!/Applications/XAMPP/xamppfiles/etc/my.cnf!
\begin{lstlisting}
[mysqld]
port = 3306
socket = /Applications/XAMPP/xamppfiles/var/mysql/mysql.sock
skip-locking
key_buffer = 128M
max_allowed_packet = 16M
table_cache = 128
sort_buffer_size = 32M
read_buffer_size = 8M
read_rnd_buffer_size = 8M
net_buffer_length = 64K
thread_stack = 256K
myisam_sort_buffer_size = 32M
tmpdir = /Applications/XAMPP/xamppfiles/temp/
max_heap_table_size = 2048M
tmp_table_size = 2048M
sync_frm = 0
skip-sync-frm=OFF
\end{lstlisting}
Do not forget to restart MySQL after editing its configuration!
\end{itemize}
Expert note:\\
If you get some ``out of memory'' errors while running ISOQuant please
make sure you start the application by giving Java Virtual Machine a
chance to have enough memory space by command line options, e.g.
\begin{lstlisting}
java -Xms256m -Xmx2G -jar ISOQuant.jar
\end{lstlisting}
this command will assign up to 2 GBs (parameter \textbf{-Xmx2G}) RAM to
the virtual machine and run the ISOQuant application. For some very
complex datasets, it may be useful to increase the \textbf{-Xmx} value
e.g. \textbf{-Xmx48G} to allow the virtual machine to access 48 GBs of
RAM.
\clearpage
\section{Data requirements}\label{data-requirements}
\subsection{Rawdata type}\label{rawdata-type}
ISOQuant has been developed for Waters QTOF LC-MSE and Waters Synapt
G2/G2-S
LC-MS\textsuperscript{E}/HDMS\textsuperscript{E}/UDMS\textsuperscript{E}
instrument data. At this time, only 1D-UPLC data is fully supported,
2D-UPLC support will be included in later releases.
\subsection{Database searches}\label{database-searches}
At the moment, ISOQuant can only process Ion Accounting workflows
(MS\textsuperscript{E}/HDMS\textsuperscript{E}/UDMS\textsuperscript{E}-data).
Classical DDA-Type experiments are not yet supported.
\subsection{Project design}\label{project-design}
There are two different ways to use ISOQuant either as an extension to
PLGS Expression Analysis or completely replacing it.
\subsubsection{Expression analysis}\label{expression-analysis}
You can use your experiment design given by running PLGS Expression
analysis. As a prerequisite for this approach, a complete expression
analysis of multiple samples and replicates is required. In PLGS, please
select autonormalization of samples for generating EMRT and protein
tables. Both EMRT and Protein tables have to be created during the
expression analysis. Each expression analysis within a PLGS project can
be selected during processing in ISOQuant. ISOQuant will create separate
databases for storing the data of every single processed expression
analysis.
\subsubsection{ISOQuant Project
Designer}\label{isoquant-project-designer}
As an alternative to the PLGS Expression analysis, you can use the
simple and efficient built-in Project Designer described in section
\ref{sec:ProjectDesigner}.
\subsection{Peak
detection/alignment/clustering}\label{peak-detectionalignmentclustering}
ISOQuant is based on peak detection, alignment and clustering of data
performed by PLGS. We are aware of some peak
splitting/alignment/clustering issues in PLGS. Therefore, we have have
spent a lot of time to develop own methods for these tasks. You can
either keep EMRT alignment/clustering results or let ISOQuant do the
complete analysis. For details see future publications.
\clearpage
\section{GUI and control elements}\label{gui-and-control-elements}
\subsection{Main view}\label{main-view}
Figure \ref{pic:mainView} shows the main view of ISOQuant. User
interaction is applied by following control elements:
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\tightlist
\item
List of projects found in PLGS root folder
\item
List of projects from ISOQuant database
\item
Button choose PLGS root folder
\item
Button choose database
\item
Button restore project from file
\item
Button find projects
\item
Button edit configuration
\item
Button show help window
\item
Button shutdown application
\end{enumerate}
\begin{figure}[htbp]
\centering
\includegraphics{pic/gui.png}
\caption{the main view of ISOQuant \label{pic:mainView}}
\end{figure}
\clearpage
\subsection{Project Finder}\label{project-finder}
The Project Finder window as shown in figure \ref{pic:FinderWindow}
makes possible to search projects lists for projects by substrings of
project titles and regular expressions matching to them. In case your
search string matches to one or multiple projects the Project Finder
will mark these projects by selecting them in both file system and
database projects lists. The Project Finder window can be accessed by
clicking the button find projects from the tool bar on the main
application window.
\begin{figure}[htbp]
\centering
\includegraphics{pic/project_finder.png}
\caption{Project Finder window \label{pic:FinderWindow}}
\end{figure}
\clearpage
\subsection{Context menu for PLGS projects in file
system}\label{context-menu-for-plgs-projects-in-file-system}
Advanced options for each project from PLGS root folder are available
from a context menu like shown in figure \ref{pic:FSContextMenu}:
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\tightlist
\item
find in database\\
finds selected projects in the list of projects from database by
comparing their titles and select them if such projects exist.
\item
about project\\
shows additional information about selected projects.
\item
import and process\\
allows to select one of predefined processing queues and starts
processing selected projects using selected processing queue.
\end{enumerate}
\begin{figure}[htbp]
\centering
\includegraphics{pic/fs_context.png}
\caption{Context menu for PLGS projects in file system
\label{pic:FSContextMenu}}
\end{figure}
\clearpage
\subsection{Context menu for projects in
database}\label{context-menu-for-projects-in-database}
Advanced options for each project from database are available from a
context menu like shown in figure \ref{pic:DBContextMenu}
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\tightlist
\item
find in file system\\
finds selected projects in the list of projects from file system by
comparing their titles and select them if such projects exist.
\item
show info\\
shows additional information about selected projects.
\item
rename project\\
rename selected projects.
\item
reprocess\\
reprocess a project starting from user selected processing stage. All
needed subsequent processing steps are automatically applied.
\item
create report\\
generate on of implemented report types.
\item
export to file\\
export selected projects from database to (backup) files which can be
imported by other ISOQuant instances.
\item
remove from database\\
removes selected projects from database.
\end{enumerate}
\begin{figure}[htbp]
\centering
\includegraphics{pic/db_context.png}
\caption{Context menu for already processed projects
\label{pic:DBContextMenu}}
\end{figure}
\textbf{Note:} We continue to develop and improve ISOQuant. The context
menus could look different in different software releases. The elements
in context menus are subject of change, their number and order may vary.
\clearpage
\subsection{Expression Analysis
Selector}\label{expression-analysis-selector}
In some cases a single PLGS project contains multiple defined Expression
Analyses. Some processing queues work with project structures provided
by PLGS Expression Analyses. These queues start with the selection of
contained expression analyses for each selected project. The selection
of expression analyses is done within the Expression Analysis Selector
window as shown in figure \ref{pic:EASelector} by activating the
checkboxes from the column include for each Expression Analysis to be
processed. The Expression Analysis Selector shows each previously
selected project in its own tab pane. ISOQuant generates a separate
database for each selected Expression Analysis.
\begin{figure}[htbp]
\centering
\includegraphics{pic/expression_analysis_selector.png}
\caption{Expression Analysis Selector \label{pic:EASelector}}
\end{figure}
\clearpage
\subsection{\texorpdfstring{Project Designer
\label{sec:ProjectDesigner}}{Project Designer }}\label{project-designer}
ISOQuant allows to create user defined project structures and then to
process these newly structured project data. User defined project
structures are created using the Project Designer as shown in figure
\ref{pic:ProjectDesigner}. The Project Designer window shows the PLGS
project structure on the left and the user defined structure on the
right. A new project structure is created by drag and drop based moving
of workflows, samples or groups between left and right structure trees.
Additionally to drag and drop actions, right click context menus are
available on the right side of Project Designer enabling editing and
removing of selected structure elements. On the top of window you can
switch between Project Designer panes to restructure each previously
selected PLGS project. Processing of designed project can be initiated
by clicking the button Ok on the bottom of window or can be aborted by
clicking the Cancel button. While processing ISOQuant generates a
separate database for each designed project.
\begin{figure}[htbp]
\centering
\includegraphics{pic/project_designer.png}
\caption{Project Designer \label{pic:ProjectDesigner}}
\end{figure}
\section{ISOQuant configuration}\label{isoquant-configuration}
ISOQuant stores parameters for program behavior and data processing
algorithms in a single configuration file named \textbf{isoquant.ini}.
This configuration file is located in the folder you have installed
ISOQuant to. For resetting parameters to default values just close
ISOQuant then delete or rename the configuration file (or single
parameter lines) and start ISOQuant again. If no configuration file can
be found on application start a new one will be created using default
parameter values.\\
\textbf{Do not change the configuration file unless you know what you
do!}
ISOQuant configuration can be edited from ISOQuant Configuration Editor
accessible from graphical user interface. Configuration Editor allows to
edit parameters and also export/import configuration settings to/from
files.
Two configuration files are provided with ISOQuant installation
packages:
\begin{itemize}
\tightlist
\item
\textbf{isoquant\_high\_confidence.ini} example configuration file for
high confidence quantitative analyses
\item
\textbf{isoquant\_maxID.ini} example configuration file for discovery
proteomics experiments
\end{itemize}
These files can be imported into ISOQuant from Configuration Editor or
manually copied to \textbf{isoquant.ini} file.
\clearpage
\section{Configuration guide}\label{configuration-guide}
This chapter lists and describes the main set of available parameters.
The number of parameters, their names and the behavior of application
caused by parameters are subjects of change because we actively work on
improving ISOQuant and underlying methods. Thus the following list of
parameters may be incomplete and/or up to date.
\subsection{EMRT cluster annotation}\label{emrt-cluster-annotation}
\subsubsection{Peptide identification
filter}\label{peptide-identification-filter}
User can define minimum reliability criteria for a peptide to be used
for ISOQuant processing. \emph{Note:} Only peptides passing this filter
will be used for all further analysis steps!
\paragraph{Peptide types}\label{peptide-types}
Peptides identified in first pass of PLGS database search (type:
\textbf{PEP\_FRAG\_1}) are generally accepted. Setting one of following
parameters to TRUE will configure ISOQuant to accept additional peptide
types.
\begin{itemize}
\tightlist
\item
\textbf{process.identification.peptide.acceptType.IN\_SOURCE}=false
\item
\textbf{process.identification.peptide.acceptType.MISSING\_CLEAVAGE}=false
\item
\textbf{process.identification.peptide.acceptType.NEUTRAL\_LOSS\_H20}=false
\item
\textbf{process.identification.peptide.acceptType.NEUTRAL\_LOSS\_NH3}=false
\item
\textbf{process.identification.peptide.acceptType.PEP\_FRAG\_2}=false
\item
\textbf{process.identification.peptide.acceptType.PTM}=false
\item
\textbf{process.identification.peptide.acceptType.VAR\_MOD}=false
\end{itemize}
Following additional filtering criteria are used as thresholds to select
peptides used for further processing steps.
\begin{itemize}
\tightlist
\item
\textbf{process.identification.peptide.minReplicationRate}=2.0\\
minimum acceptable peptide replication rate based on absolute number
of runs in which every peptide (as sequence-modifier tuple) was
identified.
\item
\textbf{process.identification.peptide.minScore}=1.0\\
minimum acceptable PLGS peptide identification score.
\item
\textbf{process.identification.peptide.minOverallMaxScore}=1.0\\
minimum acceptable value of highest PLGS identification score of a
peptide reached in any run of a project. For a peptide detected in
multiple runs its maximum reached score has to hit this score to be
accepted for annotation. Increasing score will reduce the number of
peptides used for EMRT cluster annotation and not necessarily the
overall protein quantification quality. Recommended values are between
0.0 and 5.0
\item
\textbf{process.identification.peptide.minSequenceLength}=6\\
minimum acceptable peptide sequence length. Recommended value is 6 or
more.
\end{itemize}
\subsubsection{Annotation mode}\label{annotation-mode}
\begin{itemize}
\tightlist
\item
\textbf{process.annotation.useSharedPeptides}=all
\begin{itemize}
\tightlist
\item
\textbf{all} this is the normal case.
\item
\textbf{unique} only unique peptides are used for further
processing, this option removes all shared peptides from
peptides-in-proteins relation instead of protein homology filtering
solving the problem of protein inference in a very radical way.
\item
\textbf{razor} only razor and unique peptides are used for further
processing, this option removes all shared peptides from
peptides-in-proteins relation after protein homology filtering.
Razor and unique peptides are highly reliable for protein
quantification because their intensity can be directly assigned to a
protein.
\end{itemize}
\end{itemize}
\subsubsection{Annotation conflict
filter}\label{annotation-conflict-filter}
There are cases when multiple peptide identifications map to a single
EMRT cluster.
\begin{itemize}
\tightlist
\item
\textbf{process.annotation.peptide.sequence.maxCountPerEMRTCluster}=1\\
acceptable number of different peptide sequences (remaining after
filtering peptides) allowed to annotate a single cluster. The
annotation process will skip ambiguous clusters if this value is set
to \textbf{1}. For bigger values, the annotation conflicts are
resolved by annotating clusters with the peptide having the highest
sum of PLGS identification scores in this cluster.
\end{itemize}
\subsubsection{Homology / isoform and FDR
filtering}\label{homology-isoform-and-fdr-filtering}
\begin{itemize}
\tightlist
\item
\textbf{process.annotation.protein.resolveHomology}=true\\
Should proteins be filtered for (peptide sequence based)
homology/isoform. Only one of detected homologue proteins will be
reported.
\item
\textbf{process.annotation.peptide.maxFDR}=0.01\\
maximum accepted false discovery rate level for peptides. (value 0.01
means maximum 1\% FDR)
\end{itemize}
\subsection{Data preprocessing}\label{data-preprocessing}
\begin{itemize}
\tightlist
\item
\textbf{process.peptide.deplete.PEP\_FRAG\_2}=false\\
should PEP\_FRAG\_2 peptides be completely removed from database.
\item
\textbf{process.peptide.deplete.CURATED\_0}=false\\
should CURATED=0 peptides be completely removed from database. If
\textbf{true}, low-quality peptide IDs are removed.
\end{itemize}
\subsection{EMRT table creation}\label{emrt-table-creation}
\begin{itemize}
\tightlist
\item
\textbf{process.emrt.minIntensity}=1000\\
peaks having intensities below this limit are assumed to be noise and
will not appear in EMRT table
\item
\textbf{process.emrt.minMass}=500\\
peaks having masses below this limit are assumed to be noise and will
not appear in EMRT table
\end{itemize}
\subsection{Retention time alignment}\label{retention-time-alignment}
\begin{itemize}
\tightlist
\item
\textbf{process.emrt.rt.alignment.match.maxDeltaMass.ppm}=10.0\\
maximum accepted mass difference between two signals to be assumed as
matching for retention time alignment.
\item
\textbf{process.emrt.rt.alignment.match.maxDeltaDriftTime}=2.0\\
maximum accepted drift time (ion mobility) difference between two
signals to be assumed as matching for retention time alignment. This
value is ignored for non-ion-mobility projects. Large value, e.g.~200
will disable the effect of ion mobility on the time alignment.
\item
\textbf{process.emrt.rt.alignment.minIntensity}=1000\\
only peaks with intensity over this threshold value are considered for
the retention time alignment procedure
\item
\textbf{process.emrt.rt.alignment.minMass}=800.0\\
only peaks with mass over this threshold value are considered for the
retention time alignment procedure
\item
\textbf{process.emrt.rt.alignment.normalizeReferenceTime}=false\\
if true, resulting reference times are adjusted to median distortions
at every time point.
\item
\textbf{process.emrt.rt.alignment.maxProcesses}=4\\
the maximum number of concurrent retention time alignment processes.
We recommend values between 1 and the number of available CPU cores.
Default value is set to ½ of the number of CPU cores
\item
\textbf{process.emrt.rt.alignment.maxProcessForkingDepth}=4\\
the maximum multithreading depth for each retention time alignment
process
\end{itemize}
\subsection{EMRT clustering}\label{emrt-clustering}
\begin{itemize}
\tightlist
\item
\textbf{process.emrt.clustering.distance.unit.mass.ppm}=6.0\\
minimum mass based distance between clusters. This is an instrument
dependent parameter, e.g.~6 ppm is a good value for Waters Synapt
G2/G2-S and 10-12 ppm for Waters Q-TOF Premier and Synapt G1
\item
\textbf{process.emrt.clustering.distance.unit.time.min}=0.2\\
minimum retention time based distance between clusters. This is a LC
gradient length and peak width dependent parameter, good values are
observed to be between 0.06 and 0.2, we recommend to try 0.08, 0.12,
0.16, 0.2; please report which values would work for your setup at
which gradient length
\item
\textbf{process.emrt.clustering.distance.unit.drift.bin}=2.0\\
menimum drift time based distance between clusters. This is an
instrument and also project setup dependent parameter, e.g.~for pure
IMS projects containing G2 or G2S data, we recommend a value of 2.0.
This value is ignored for non-ion-mobility projects. Large value,
e.g.~200 will disable the effect of ion mobility on the EMRT
clustering.
\item
\textbf{process.emrt.clustering.dbscan.minNeighborCount}=2\\
the minimum cluster size (except of noise) and also the minimum
required number of peaks inside the reachability radius for cluster
expansion. This is a DBSCAN specific parameter and should be increased
for big projects. The value of this parameter also depends on used
clustering distance units.
\item
\textbf{process.emrt.clustering.maxProcesses}=8\\
the maximum number of concurrent clustering processes. For best
performance is reached by setting this value to the number of
available CPU cores. Default value is set by the estimated number of
available CPU cores.
\end{itemize}
\subsection{Peak intensity
normalization}\label{peak-intensity-normalization}
\begin{itemize}
\item
\textbf{process.normalization.minIntensity}=3000\\
systematic errors of peptides with intensities below this limit are
ignored during normalization process.
\item
\textbf{process.normalization.lowess.bandwidth}=0.3\\
bandwidth parameter for non-linear regression method (LOWESS) used for
exploring systematic errors during normalization process. Recommended
values are between 0.3 and 0.6\\
\item
\textbf{process.normalization.orderSequence}=XPIR\\
The processing order sequence of dynamic multi-dimensional
normalization. The processing order sequence is defined as a word
build from following characters: \textbf{X, P, G, S, W, I, R, M, E}.
The occurrence of a letter either defines the next dimension for EMRT
normalization or changes the normalization mode or discards previously
calculated values:
\begin{description}
\tightlist
\item[X]
reset emrt intensities to original values
\item[P]
activate IN-PROJECT normalization mode, average intensity of all emrts
in a cluster is used as the reference.
\item[G]
activate IN-GROUP normalization mode, average intensity of all emrts
from a group of samples within a cluster is used as the reference.
T.m. each run uses reference values from its sample group.
\item[S]
activate IN-SAMPLE normalization mode, average intensity of all emrts
from a sample within a cluster is used as the reference. T.m. each run
uses reference values from its sample.
\item[W]
activate Workflow/Run-Value based normalization mode, the run to be
the normalization reference is automatically set by choosing the run
with the highest number of emrts.
\item[I]
normalize emrt intensities using log-intensity dimension
\item[R]
normalize emrt intensities using retention time dimension
\item[M]
normalize emrt intensities using mass dimension
\item[E]
equalize emrt intensities by adjusting sums of intensities for each
run
\end{description}
The order sequence is processed from left to right, e.g.~the
recommended order sequence \textbf{XPIR} stands for clean in-project
normalization using intensity domain followed by normalization using
retention time domain.
\end{itemize}
\subsection{Protein quantification}\label{protein-quantification}
\subsubsection{Peptide filtering}\label{peptide-filtering}
Peptides for protein quantification may be filtered by their type and
minimum reached score of a peptide per EMRT cluster.
\textbf{PEP\_FRAG\_1} peptides are always accepted. User may decide to
accept additional peptide types for quantification. Allowing additional
types may result in higher number of quantified proteins but also may
affect the quality of quantification. \emph{Note:} This peptide
filtering step can not recover peptides not passed the peptide
identification filter.
\begin{itemize}
\tightlist
\item
\textbf{process.quantification.peptide.acceptType.IN\_SOURCE}=false
\item
\textbf{process.quantification.peptide.acceptType.MISSING\_CLEAVAGE}=false
\item
\textbf{process.quantification.peptide.acceptType.NEUTRAL\_LOSS\_H20}=false
\item
\textbf{process.quantification.peptide.acceptType.NEUTRAL\_LOSS\_NH3}=false
\item
\textbf{process.quantification.peptide.acceptType.PEP\_FRAG\_2}=false
\item
\textbf{process.quantification.peptide.acceptType.PTM}=false
\item
\textbf{process.quantification.peptide.acceptType.VAR\_MOD}=false
\item
\textbf{process.quantification.peptide.minMaxScorePerCluster}=5.0
\end{itemize}
\subsubsection{Protein quantification
setting}\label{protein-quantification-setting}
\begin{itemize}
\tightlist
\item
\textbf{process.quantification.absolute.standard.entry}=ENO1\_YEAST\\
entry of protein used as quantification standard
\item
\textbf{process.quantification.absolute.standard.fmol}=50.0\\
amount of quantification standard protein
\item
\textbf{process.quantification.absolute.standard.used}=true\\
is a quantification standard protein used at all?
\item
\textbf{process.quantification.topx.degree}=3\\
maximum number of peptides for quantifying single proteins
\item
\textbf{process.quantification.maxProteinFDR}=0.01\\
maximum accepted false discovery rate level for reported proteins.
(value 0.01 means 1\% FDR level)
\item
\textbf{process.quantification.minPeptidesPerProtein}=1\\
a protein is reported only if it can be quantified by using as minimum
this number of peptides
\end{itemize}
\subsection{Application behavior}\label{application-behavior}
\subsubsection{User interface}\label{user-interface}
\begin{itemize}
\tightlist
\item
\textbf{setup.ui.captureConsoleMessages}=true\\
show Java console messages inside ISOQuant message panel
\item
\textbf{setup.ui.location.left}=560\\
ISOQuant window location, pixels from left
\item
\textbf{setup.ui.location.top}=360\\
ISOQuant window location, pixels from top
\item
\textbf{setup.ui.size.height}=480\\
ISOQuant window height
\item
\textbf{setup.ui.size.width}=800\\
ISOQuant window width
\item
\textbf{setup.ui.promptForExit}=true\\
ask user on closing window
\item
\textbf{setup.ui.iconScaleFactor}=1.0\\
scale original icon sizes by this factor, may be useful on unusually
small or large screens.
\end{itemize}
\subsubsection{Data source}\label{data-source}
\begin{itemize}
\tightlist
\item
\textbf{setup.db.autoLoad}=false\\
should application connect database on start
\item
\textbf{setup.db.host}=localhost\\
the MySQL database host name or ip address. Default tcp port number
for MySQL servers is 3306. If your MySQL server is running using an
other tcp port number, its host name has to be expanded by adding `:'
and the correct port number, e.g.~localhost:3307 for MySQL server
running on local machine and listening at tcp port 3307
\item
\textbf{setup.db.user}=root\\
MySQL user name
\item
\textbf{setup.db.pass}=\\
MySQL users password
\item
\textbf{setup.plgs.root.showEACount}=true\\
should number of PLGS expression analyses be determined and shown
\item
\textbf{setup.plgs.root.showFSSize}=false\\
should file system size of a projects folder be determined and shown
\item
\textbf{setup.plgs.root.dir}=/Volumes/RAID0/PLGS2.5/root\\
path of last selected PLGS root folder
\item
\textbf{setup.plgs.root.autoLoad}=false\\
should application read last used root folder on start
\end{itemize}
\subsubsection{Report}\label{report}
\begin{itemize}
\tightlist
\item
\textbf{setup.report.dir}=/Volumes/RAID0/reports\\
path of last selected report output folder.
\item
\textbf{setup.report.csv.columnSeparator}=`,'\\
column separator string (enclosed in ' or "), usually either `,' or
`;'
\item
\textbf{setup.report.csv.decimalPoint}=`.'\\
decimal point string (enclosed in ' or "), usually either `.' or `,'
\item
\textbf{setup.report.csv.textQuote}='``'\\
string for quoting text blocks, usually
\item
\textbf{setup.report.mzidentml.DBNCBITaxID}=
\item
\textbf{setup.report.mzidentml.DBOrganismScientificName}=
\item
\textbf{setup.report.mzidentml.DBversion}=
\item
\textbf{setup.report.mzidentml.researcherFirstName}=John
\item
\textbf{setup.report.mzidentml.researcherLastName}=Doe
\item
\textbf{setup.report.mzidentml.researcherOrganization}=Uni-Mainz
\item
\textbf{setup.report.xls.showAbsQuantFMOLUG}=true\\
create an extra sheet for absolute protein quantity in femtomoles per
microgram.
\item
\textbf{setup.report.xls.showAbsQuantFMOL}=true\\
create an extra sheet for absolute protein quantity in femtomoles.
\item
\textbf{setup.report.xls.showAbsQuantNG}=true\\
create an extra sheet for absolute protein quantity in nanograms.
\item
\textbf{setup.report.xls.showAbsQuantPPM}=true\\
create an extra sheet for absolute protein quantity in parts per
million.
\item
\textbf{setup.report.xls.showAllProteins}=false\\
create an extra sheet for some PLGS based proteins details.
\item
\textbf{setup.report.xls.showRTAlignment}=false\\
create an extra sheet for retention alignment results.
\end{itemize}
Generated excel sheets are limited to maximum 65536 rows when using old
XLS (Excel 97/2000/2003) format due to its technical limitations. In
case of doubt, please use XLSX format for creating ISOQuant reports.
\clearpage
\section{End-user license agreement}\label{end-user-license-agreement}
\subsection{External components}\label{external-components}
ISOQuant relies on external components (re)distributed under different
conditions. By using ISOQuant you need to agree to terms and conditions
of third party libraries and software included in ISOQuant or needed for
running ISOQuant.
ISOQuant uses following external Java libraries:
\begin{longtable}[]{@{}llll@{}}
\toprule
\begin{minipage}[b]{0.16\columnwidth}\raggedright\strut
Library\strut
\end{minipage} & \begin{minipage}[b]{0.11\columnwidth}\raggedright\strut
Version\strut
\end{minipage} & \begin{minipage}[b]{0.21\columnwidth}\raggedright\strut
License Type\strut
\end{minipage} & \begin{minipage}[b]{0.32\columnwidth}\raggedright\strut
Purpose\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.16\columnwidth}\raggedright\strut
JDOM\strut
\end{minipage} & \begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
1.1.3\strut
\end{minipage} & \begin{minipage}[t]{0.21\columnwidth}\raggedright\strut
BSD License\strut
\end{minipage} & \begin{minipage}[t]{0.32\columnwidth}\raggedright\strut
XML handling\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.16\columnwidth}\raggedright\strut
Tagsoup\strut
\end{minipage} & \begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
1.2.1\strut
\end{minipage} & \begin{minipage}[t]{0.21\columnwidth}\raggedright\strut
Apache v2.0\strut
\end{minipage} & \begin{minipage}[t]{0.32\columnwidth}\raggedright\strut
XML parsing\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.16\columnwidth}\raggedright\strut
MySQL Connector/J\strut
\end{minipage} & \begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
5.1.13\strut
\end{minipage} & \begin{minipage}[t]{0.21\columnwidth}\raggedright\strut
GPLv2 with\\
FOSS Exception\strut
\end{minipage} & \begin{minipage}[t]{0.32\columnwidth}\raggedright\strut
database communication\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.16\columnwidth}\raggedright\strut
JSiX\strut
\end{minipage} & \begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
1.0\strut
\end{minipage} & \begin{minipage}[t]{0.21\columnwidth}\raggedright\strut
BSD License\strut
\end{minipage} & \begin{minipage}[t]{0.32\columnwidth}\raggedright\strut
Java extensions\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.16\columnwidth}\raggedright\strut
POI\strut
\end{minipage} & \begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
3.8\strut
\end{minipage} & \begin{minipage}[t]{0.21\columnwidth}\raggedright\strut
Apache v2.0\strut
\end{minipage} & \begin{minipage}[t]{0.32\columnwidth}\raggedright\strut
spreadsheet file creation\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.16\columnwidth}\raggedright\strut
DOM4J\strut
\end{minipage} & \begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
1.6.1\strut
\end{minipage} & \begin{minipage}[t]{0.21\columnwidth}\raggedright\strut
BSD License\strut
\end{minipage} & \begin{minipage}[t]{0.32\columnwidth}\raggedright\strut
POI dependency\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.16\columnwidth}\raggedright\strut
StAX\strut
\end{minipage} & \begin{minipage}[t]{0.11\columnwidth}\raggedright\strut
1.0.1\strut
\end{minipage} & \begin{minipage}[t]{0.21\columnwidth}\raggedright\strut
Apache v2.0\strut
\end{minipage} & \begin{minipage}[t]{0.32\columnwidth}\raggedright\strut
POI dependency\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}
Binary versions of these libraries are repackaged into and redistributed
with ISOQuant software package according to their license conditions.
Please find original licenses as part of ISOQuant package.
Furthermore, ISOQuant relies on external environmental software being
not a part or a component of ISOQuant but needed to run it:
\begin{itemize}
\tightlist
\item
Operating System
\item
Java Virtual Machine
\item
MySQL 5.1 compatible database engine (e.g.~MySQL Server:
\textbf{http://www.mysql.com/} or MariaDB:
\textbf{http://mariadb.org/})
\item
Waters ProteinLynx Global Server
\end{itemize}
Please pay attention to terms and conditions arising from any software
usage in any way related to ISOQuant.
\clearpage
\subsection{\texorpdfstring{ISOQuant license agreement
\label{bsdlicense}}{ISOQuant license agreement }}\label{isoquant-license-agreement}
ISOQuant binaries and source code are available under conditions of BSD
license as follows:
\begin{lstlisting}
ISOQuant - integrated solution for LC-MS based label-free protein quantification
Copyright (c) 2009 - 2013, JOERG KUHAREV and STEFAN TENZER
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. 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.
3. All advertising materials mentioning features or use of this software
must display the following acknowledgement:
This product includes software developed by JOERG KUHAREV and STEFAN TENZER.
4. Neither the name "ISOQuant" 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 JOERG KUHAREV and STEFAN TENZER ''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 JOERG KUHAREV 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.
\end{lstlisting}
\subsection{Disclaimer in plain
language}\label{disclaimer-in-plain-language}
\begin{itemize}
\tightlist
\item
ISOQuant is an academically developed freely available software
implemented using only freely available technologies
\item
By using ISOQuant you automatically agree to terms and conditions of
third party libraries and software included in ISOQuant or needed for
running ISOQuant
\item
We provide ISOQuant as is, without any kind of warranty
\item
You are using ISOQuant at your own risk, we are not responsible for
any kind of damage, errors or data loss produced in any way related to
ISOQuant.
\end{itemize}
\clearpage
\section{About developers}\label{about-developers}
ISOQuant is developed by
\begin{itemize}
\tightlist
\item
Jörg Kuharev
(\href{mailto:[email protected]}{\nolinkurl{[email protected]}})
and
\item
Pedro Navarro
(\href{mailto:[email protected]}{\nolinkurl{[email protected]}})
and
\item
Stefan Tenzer
(\href{mailto:[email protected]}{\nolinkurl{[email protected]}})
\end{itemize}
UNIVERSITÄTSMEDIZIN\\
der Johannes Gutenberg-Universität\\
Institut für Immunologie\\
Core Facility für Massenspektrometrie\\
Germany, Mainz, \today
\begin{center}\rule{0.5\linewidth}{\linethickness}\end{center}
\clearpage
\section*{References}\label{references}
\addcontentsline{toc}{section}{References}
\hypertarget{refs}{}
\hypertarget{ref-bond_improving_2013}{}
Bond, Nicholas J, Pavel V Shliaha, Kathryn S Lilley, and Laurent Gatto.
2013. ``Improving Qualitative and Quantitative Performance for MS
E-Based Label-Free Proteomics.'' \emph{Journal of Proteome Research}.
\hypertarget{ref-distler_drift_2014}{}
Distler, Ute, Jörg Kuharev, Pedro Navarro, Yishai Levin, Hansjörg
Schild, and Stefan Tenzer. 2014. ``Drift Time-Specific Collision
Energies Enable Deep-Coverage Data-Independent Acquisition Proteomics.''
\emph{Nature Methods} 11 (2): 167--70.
doi:\href{https://doi.org/10.1038/nmeth.2767}{10.1038/nmeth.2767}.
\hypertarget{ref-ester_density-based_1996}{}
Ester, Martin, Hans P. Kriegel, Jorg Sander, and Xiaowei Xu. 1996. ``A
Density-Based Algorithm for Discovering Clusters in Large Spatial
Databases with Noise.'' In \emph{Second International Conference on
Knowledge Discovery and Data Mining}, edited by Evangelos Simoudis,
Jiawei Han, and Usama Fayyad, 226--31. Portland, Oregon: AAAI Press.
\hypertarget{ref-kuharev_-depth_2015}{}
Kuharev, Jörg, Pedro Navarro, Ute Distler, Olaf Jahn, and Stefan Tenzer.
2015. ``In-Depth Evaluation of Software Tools for Data-Independent
Acquisition Based Label-Free Quantification.'' \emph{PROTEOMICS}.
doi:\href{https://doi.org/10.1002/pmic.201400396}{10.1002/pmic.201400396}.
\hypertarget{ref-nesvizhskii_interpretation_2005}{}
Nesvizhskii, Alexey I., and Ruedi Aebersold. 2005. ``Interpretation of
Shotgun Proteomic Data: The Protein Inference Problem.'' \emph{Molecular
\& Cellular Proteomics: MCP} 4 (10): 1419--40.
doi:\href{https://doi.org/10.1074/mcp.R500012-MCP200}{10.1074/mcp.R500012-MCP200}.
\hypertarget{ref-podwojski_retention_2009}{}
Podwojski, Katharina, Arno Fritsch, Daniel C. Chamrad, Wolfgang Paul,
Barbara Sitek, Kai Stühler, Petra Mutzel, et al. 2009. ``Retention Time
Alignment Algorithms for LC/MS Data Must Consider Non-Linear Shifts.''
\emph{Bioinformatics} 25 (6): 758--64.
doi:\href{https://doi.org/10.1093/bioinformatics/btp052}{10.1093/bioinformatics/btp052}.
\hypertarget{ref-silva_absolute_2006}{}
Silva, Jeffrey C, Marc V Gorenstein, Guo-Zhong Li, Johannes P C Vissers,
and Scott J Geromanos. 2006. ``Absolute Quantification of Proteins by
LCMSE: A Virtue of Parallel MS Acquisition.'' \emph{Molecular \&
Cellular Proteomics: MCP} 5 (1): 144--56.
doi:\href{https://doi.org/10.1074/mcp.M500230-MCP200}{10.1074/mcp.M500230-MCP200}.
\end{document}
|
```python
%pylab inline
%config InlineBackend.figure_format = 'retina'
from ipywidgets import interact
```
Populating the interactive namespace from numpy and matplotlib
# Question 1
# A
Consider the function $f(x)=x^3 -9x^2 +11x-11$, which has a root in the interval $(-10,10)$. Calculate by hand the first 3 iterations of Newton's method to estimate the root of $f(x)$, using the initial guess $x_0=0$. What happens?
---------------------------------------
## Solution
Starting with the initial guess $x_0=0$, the first three iterations using Newton's method are
\begin{align}
x_1 &= 0 - \frac{-11}{11} = 1 \\
x_2 &= 1 - \frac{1^3-9\cdot1^2+11\cdot1-11}{3\cdot1^2-18\cdot1+11} = 1-\frac{-8}{-4} = -1 \\
x_3 &= -1 - \frac{(-1)^3-9(-1)^2+11(-1)-11}{3(-1)^2-18(-1)+11} = -1 - \frac{-32}{32} = 0 = x_0
\end{align}
Computing the first three iterates we find that Newton's method with $x_0=0$ results in a cycle with period 3.
# B
Write a python code that uses bisection to determine a better choice of $x_0$, then feed this new initial guess to a Newton's method solver. Iterate your Newton's method solver until you have found the root of $f(x)$ to within a tolerance of $\epsilon=10^{-6}$, and report the value of the root.
```python
# ====== bisection method followed by Newton's method ======
def f(x):
return x**3 - 9*x**2 + 11*x - 11
def df(x):
return 3*x**2 - 18*x + 11
# ------ endpoints, max iterations, and tolerance ------
a=-10 #left endpoint
b=10 #right endpoint
N=25 #max iterations for bisection & newton's
tol=(b-1)/2 #very broad tolerance for bisection. NOTE: this was chosen aftercomputing bisection by hand
#until the subinterval no longer contained -1, 0, or 1. See text below
# ------ bisection (Burden & Faires Numerical Analysis 9th ed) ------
i=1
FA=f(a)
while i<=N:
p = a + (b-a)/2
FP=f(p)
if FP==0 or (b-a)/2<tol: break #return p=x0 for newton's
i+=1
if FA*FP>0:
a=p
FA=FP
else:
b=p
print('Bisection complete. Using x0 =',p,'as initial guess for Newton\'s method')
# ------ newton's method adapted from Lab 2 ------
tol=10**(-6) #update tolerance
x=p #switch from p to x so notation is familiar
# ------ compute x_1 directly so we can do 1st comparison ------
xn = x - f(x)/df(x)
i=1 #initialize an iteration counter
while abs(xn-x)>tol and i<=N:
x=xn
xn = x - f(x)/df(x)
i+=1
print('Convergence for Newton\'s method was achieved using',i,'iterations')
print('The root of f(x) is',x)
```
Bisection complete. Using x0 = 7.5 as initial guess for Newton's method
Convergence for Newton's method was achieved using 4 iterations
The root of f(x) is 7.765951540351796
# Question 2
# A
Derive a third order method for solving $f(x) = 0$ in a way similar to the derivation of Newton’s method, using evaluations of $f(x_n)$, $f’(x_n)$, and $f’’(x_n)$. Show that in the course of derivation, a quadratic equation arises, and therefore two distinct schemes can be derived. **Hint: Expand $f(x)$ around $x_n$.**
---------------------------------------
## Solution
Expand $f(x)$ around $x_n$ to get
$$ f(x) = f(x_n) + (x - x_n)f'(x_n) + \frac{(x - x_n)^2}{2}f''(x_n) + O((x - x_n)^3). $$
Set $x = \hat{x}$ and use $f(\hat{x})=0$ to get
$$ 0 = f(x_n) + (\hat{x} - x_n)f'(x_n) + \frac{(\hat{x} - x_n)^2}{2}f''(x_n) + O((\hat{x} - x_n)^3). $$
Solving for $\hat{x}$, we have
$$\frac{1}{2}f''(x_n) \hat{x}^2 + (f'(x_n) - x_n f''(x_n))\hat{x} + f(x_n) - x_n f'(x_n) + \frac{x_n^2}{2}f''(x_n) = O((\hat{x} - x_n)^3).$$
Setting the right hand side to zero, we find two solutions for $\hat{x}$,
\begin{equation}
\hat{x} = x_n - \frac{f'(x_n)}{f''(x_n)}\left[1 \pm \sqrt{1 - \frac{2 f''(x_n) f(x_n)}{f'(x_n)^2}}\right].
\end{equation}
**There is one valid solution if we require $x_n \to \hat{x}$ as $f(x_n)\to 0$.** To see this, set $f(x_n)=0$ in the above equation and solve for $y=\hat{x}-x_n$. Only one of the two solutions is zero (assuming that $f'(\hat{x}) \neq 0$). This might seem counter intuitive, but it is not once you look at it in simpler terms. There are two (possibly complex) roots of the polynomial $ax^2 + bx + c = 0$ (assuming $a \neq 0$), but only one of them will vanish as $c\to 0$ (assuming $b \neq 0$).
Hence,
\begin{equation}
\hat{x} = x_n - \frac{f'(x_n)}{f''(x_n)}\left[1 - \sqrt{1 - \frac{2 f''(x_n) f(x_n)}{f'(x_n)^2}}\right] + O((\hat{x} - x_n)^3).
\end{equation}
Using the above, we propose the fixed point iteration
$$ x_{n+1} = g(x_n) = x_n - \frac{f'(x_n)}{f''(x_n)}\left[1 - \sqrt{1 - \frac{2 f''(x_n) f(x_n)}{f'(x_n)^2}}\right]$$
------------------------------------------------------------------------------------------
**Comment:** The above is sufficient for full credit. However, one can futher simplify the method by expanding the square root term around $y = 0$, where $y = f(x_n)$. Assuming that $\hat{x}$ is a simple root, we have $f(x_n) = O(x_n - \hat{x})$, $f'(x_n) = O(1)$, and $f''(x_n) = O(1)$. To maintain the same accuracy, we need to expand the square root to explicitly include $O(y^2)$ terms. The $O(y^3)$ terms can be ignored and the same accuracy will be maintained. This leads to the iteration formula
$$ x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)} - \frac{f''(x_n)f(x_n)^2}{f'(x_n)^3}.$$
One can show that the above iteration method also has cubic convergence.
# B
Show that the order of convergence (under appropriate conditions) is cubic.
---------------------------------------
## Solution
From the solution of part A we have
\begin{equation}
\hat{x} = x_n - \frac{f'(x_n)}{f''(x_n)}\left[1 - \sqrt{1 - \frac{2 f''(x_n) f(x_n)}{f'(x_n)^2}}\right] + O((\hat{x} - x_n)^3),
\end{equation}
and
$$ x_{n+1} = g(x_n) = x_n - \frac{f'(x_n)}{f''(x_n)}\left[1 - \sqrt{1 - \frac{2 f''(x_n) f(x_n)}{f'(x_n)^2}}\right].$$
Taking the difference of the above two equation yields
$$ \vert x_{n+1} - \hat{x} \vert = O((\hat{x} - x_n)^3). $$
# C
Implement the root-finding method in Python to compute the root of $f(x) = x^3 - 2$. Add a stopping criterion that requires $\vert f(x_n) \vert \leq 10^{-8}$. Save the value of $x_n$ at each iteration and create a plot showing the convergence rate.
```python
## parameters
max_steps = 50 ## max number of iterations to use
tol = 1e-8 ## 10^(-8)
x0 = 2.
xhat = 2.**(1/3.)
def f(x):
return x**3 - 2.
def fp(x):
return 3*x**2
def fpp(x):
return 6*x
x = [x0]
for j in arange(max_steps):
fj = f(x[j])
fpj = fp(x[j])
fppj = fpp(x[j])
x.append(x[j] - fpj/fppj*(1 - sqrt(1 - 2*fppj*fj/fpj**2)))
if absolute(fj) < tol:
break ## this will stop the for loop
x = array(x) ## convert the list into an array
figure(1, [7, 4])
xplot = linspace(-1, 2, 200)
plot(xplot, 0*xplot, 'k') ## plot the line y=0
plot(xplot, f(xplot)) ## plot f(x)
plot(x, f(x), '*') ## plot the iterates of bisection
xlabel(r'$x$', fontsize=24) ## x axis label
ylabel(r'$f(x)$', fontsize=24); ## y axis label
## Convergence plot
figure(2, [7, 4])
err = absolute(x - xhat)
loglog(err[:-1], err[1:], '*') ## plot the iterates of bisection
err_plot = array([1e-3, 1e-2, 1e-1, 1.])
conv = err_plot**3 # quadratic. the theoretecal convergence curve
loglog(err_plot, conv, 'k')
xlim(1e-3, 1)
xlabel(r'$\vert x_n - \hat{x}\vert$', fontsize=24) ## x axis label
ylabel(r'$\vert x_{n+1} - \hat{x}\vert$', fontsize=24) ## y axis label
title('cubic convergence');
```
# D
Using your code and the function $f$ defined in part C, numerically estimate the number of iterations needed to reduce the initial error, $\mathcal{E}_0 = \vert \hat{x} - x_0\vert$, by factor of $10^m$ for $m=1, \ldots 4$. Do this for each of the initial guesses $x_0 = 0.25, 1.25$.
```python
x_exact = 2.**(1./3.)
def number_of_iterations(x0, reduce_factor):
initial_error = absolute(x0 - x_exact)
x = [x0]
for j in arange(max_steps):
fj = f(x[j])
fpj = fp(x[j])
fppj = fpp(x[j])
x.append(x[j] - fpj/fppj*(1 - sqrt(1 - 2*fppj*fj/fpj**2)))
if absolute(x[-1] - x_exact) < initial_error/reduce_factor:
break ## this will stop the for loop
return j + 1
print('for x0 = 0.25')
print('number of iterations needed:')
print([number_of_iterations(0.25, 10.**m) for m in arange(1, 5)])
print('')
print('for x0 = 1.25')
print('number of iterations needed:')
print([number_of_iterations(1.25, 10.**m) for m in arange(1, 5)])
```
for x0 = 0.25
number of iterations needed:
[2, 3, 3, 3]
for x0 = 1.25
number of iterations needed:
[1, 1, 1, 1]
## JUST FOR FUN!!!
```python
x_exact = 2.**(1./3.)
def number_of_iterations_V2(x0, reduce_factor):
initial_error = absolute(x0 - x_exact)
x = [x0]
for j in arange(max_steps):
fj = f(x[j])
fpj = fp(x[j])
fppj = fpp(x[j])
x.append(x[j] - fj/fpj - fppj*fj**2/fpj**3) ## See the comment in my answer to part A
if absolute(x[-1] - x_exact) < initial_error/reduce_factor:
break ## this will stop the for loop
return j + 1
print('for x0 = -1')
print('number of iterations needed:')
print([number_of_iterations_V2(-1., 10.**m) for m in arange(1, 5)])
print('')
print('for x0 = 0.1')
print('number of iterations needed:')
print([number_of_iterations_V2(0.1, 10.**m) for m in arange(1, 5)])
print('')
print('for x0 = 1.25')
print('number of iterations needed:')
print([number_of_iterations_V2(1.25, 10.**m) for m in arange(1, 5)])
print('')
print('for x0 = 2.25')
print('number of iterations needed:')
print([number_of_iterations_V2(2.25, 10.**m) for m in arange(1, 5)])
print('')
print('for x0 = 3.25')
print('number of iterations needed:')
print([number_of_iterations_V2(3.25, 10.**m) for m in arange(1, 5)])
```
for x0 = -1
number of iterations needed:
[2, 2, 3, 3]
for x0 = 0.1
number of iterations needed:
[19, 20, 20, 21]
for x0 = 1.25
number of iterations needed:
[1, 1, 2, 2]
for x0 = 2.25
number of iterations needed:
[1, 2, 2, 3]
for x0 = 3.25
number of iterations needed:
[2, 3, 3, 4]
```python
```
|
Formal statement is: lemma linear_compose: "linear f \<Longrightarrow> linear g \<Longrightarrow> linear (g \<circ> f)" Informal statement is: If $f$ and $g$ are linear maps, then $g \circ f$ is a linear map. |
/**
* Copyright (c) 2019 Melown Technologies SE
*
* 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.
*
* 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 HOLDER 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.
*/
#include <cstdlib>
#include <utility>
#include <functional>
#include <map>
#include <boost/regex.hpp>
#include <boost/optional.hpp>
#include <boost/filesystem.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/regex.hpp>
#include <boost/algorithm/string/trim.hpp>
#include "utility/streams.hpp"
#include "utility/buildsys.hpp"
#include "utility/path.hpp"
#include "utility/enum-io.hpp"
#include "utility/path.hpp"
#include "utility/filesystem.hpp"
#include "utility/format.hpp"
#include "utility/md5.hpp"
#include "service/cmdline.hpp"
#include "service/ctrlclient.hpp"
#include "service/pidfile.hpp"
#include "gdal-drivers/register.hpp"
#include "vts-libs/registry/po.hpp"
// mapproxy stuff
#include "mapproxy/support/tileindex.hpp"
namespace po = boost::program_options;
namespace fs = boost::filesystem;
namespace ba = boost::algorithm;
namespace vts = vtslibs::vts;
namespace vr = vtslibs::registry;
class GenerateTileIndex : public service::Cmdline {
public:
GenerateTileIndex()
: service::Cmdline("generate-tileindex", BUILD_TARGET_VERSION)
, navtiles_(false), resource_({})
{}
private:
void configuration(po::options_description &cmdline
, po::options_description &config
, po::positional_options_description &pd);
void configure(const po::variables_map &vars);
bool help(std::ostream &out, const std::string &what) const;
int run();
fs::path tiling_;
bool navtiles_;
Resource resource_;
fs::path output_;
};
void GenerateTileIndex::configuration(po::options_description &cmdline
, po::options_description &config
, po::positional_options_description &pd)
{
vr::registryConfiguration(config, vr::defaultPath());
cmdline.add_options()
("tiling", po::value(&tiling_)->required()
, "Path to reference frame tiling.")
("referenceFrame", po::value(&resource_.id.referenceFrame)->required()
, "Reference frame.")
("resouce.group", po::value(&resource_.id.group)->default_value("id")
, "Resource identifier.")
("resouce.id", po::value(&resource_.id.id)->default_value("group")
, "Resource group.")
("resouce.id", po::value(&resource_.id.id)->required()
, "Resource group.")
("lodRange", po::value(&resource_.lodRange)->required()
, "Valid LOD range.")
("tileRange", po::value(&resource_.tileRange)->required()
, "Valid tile range at lodRange.min.")
("output", po::value(&output_)->required()
, "Output file.")
;
(void) config;
(void) pd;
}
void GenerateTileIndex::configure(const po::variables_map &vars)
{
vr::registryConfigure(vars);
resource_.referenceFrame
= &vr::system.referenceFrames(resource_.id.referenceFrame);
}
bool GenerateTileIndex::help(std::ostream &out, const std::string &what) const
{
if (what.empty()) {
// program help
out << ("Generate tileindex from lod/tile ranges and reference frame "
"tiling.\n"
);
return true;
}
return false;
}
int GenerateTileIndex::run()
{
vts::TileIndex out;
prepareTileIndex(out, &tiling_, resource_, navtiles_);
out.save(output_);
return EXIT_SUCCESS;
}
int main(int argc, char *argv[])
{
// force VRT not to share underlying datasets
gdal_drivers::registerAll();
return GenerateTileIndex()(argc, argv);
}
|
[STATEMENT]
lemma ACC_I[intro]: "G \<in> \<G> \<Longrightarrow> X \<tturnstile> G \<Longrightarrow> G \<in> ACC X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>G \<in> \<G>; X \<tturnstile> G\<rbrakk> \<Longrightarrow> G \<in> ACC X
[PROOF STEP]
unfolding ACC_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>G \<in> \<G>; X \<tturnstile> G\<rbrakk> \<Longrightarrow> G \<in> {G \<in> \<G>. X \<tturnstile> G}
[PROOF STEP]
by auto |
module B
public export
record Rec where
constructor MkRec
field : Char --- Unit and Bool don't cause the bug
public export
defaultRec : Rec
defaultRec = MkRec 'a'
|
import numpy as np
from modpy.special._gamma import gammaln
def beta(a, b):
return np.exp(gammaln(a) + gammaln(b) - gammaln(a + b))
def _chk_betainc_inp(x, a, b):
if isinstance(x, float):
if isinstance(a, np.ndarray):
x = np.repeat(x, a.size)
elif isinstance(b, np.ndarray):
x = np.repeat(x, b.size)
else:
x = np.atleast_1d(x)
if np.any((x < 0.) & (1. < x)):
raise ValueError('All values of `x` must satisfy in 0 <= x <= 1.')
if isinstance(a, float):
a = np.repeat(a, x.size)
if np.any(a <= 0):
raise ValueError('All values of `a` must be strictly positive numbers.')
if isinstance(b, float):
b = np.repeat(b, x.size)
if np.any(b <= 0):
raise ValueError('All values of `b` must be strictly positive numbers.')
if not ((x.shape == a.shape) and (x.shape == b.shape)):
raise ValueError('`x`, `a` and `b` must have the same shape.')
return x, a, b
def betainc(x, a, b):
"""
Calculates the incomplete beta function, i.e.::
B(x; a, b) = 1 / B(a, b) * \int_0^x t^{a-1}(1-t)^{b-1} dt
NOTE:
Inspired by: https://malishoaib.wordpress.com/2014/04/15/the-beautiful-beta-functions-in-raw-python/
Parameters
----------
x : float or array_like, shape (n,)
Variable to be evaluated
a : float or array_like, shape (n,)
First parameter of beta function
b : float or array_like, shape (n,)
Second parameter of beta function
Returns
-------
y : array_like, shape (n,)
Resulting value
"""
x, a, b = _chk_betainc_inp(x, a, b)
y = np.zeros_like(x)
i = np.argwhere(x < (a + 1.) / (a + b + 2.))
i_ = np.setdiff1d(np.arange(x.size), i)
y[i] = np.exp(betaincln(x[i], a[i], b[i])) * _beta_cont_frac(x[i], a[i], b[i]) / a[i]
y[i_] = 1. - np.exp(betaincln(x[i_], a[i_], b[i_])) * _beta_cont_frac(1. - x[i_], b[i_], a[i_]) / b[i_]
y = np.where(x == 1., 1., y)
return y
def betaln(a, b):
"""
Calculates the logarithm of the beta function.
Parameters
----------
a : float or array_like, shape (n,)
First parameter of beta function
b : float or array_like, shape (n,)
Second parameter of beta function
Returns
-------
y : array_like, shape (n,)
Resulting value
"""
return np.log(np.abs(beta(a, b)))
def betaincln(x, a, b):
"""
Calculates the logarithm of the incomplete beta function, i.e.::
ln(B(x; a, b)) = ln(1 / B(a, b) * \int_0^x t^{a-1}(1-t)^{b-1} dt)
NOTE:
Inspired by: https://malishoaib.wordpress.com/2014/04/15/the-beautiful-beta-functions-in-raw-python/
Parameters
----------
x : float or array_like, shape (n,)
Variable to be evaluated
a : float or array_like, shape (n,)
First parameter of beta function
b : float or array_like, shape (n,)
Second parameter of beta function
Returns
-------
y : array_like, shape (n,)
Resulting value
"""
return gammaln(a + b) - gammaln(a) - gammaln(b) + a * np.log(x) + b * np.log(1. - x)
def _beta_cont_frac(x, a, b, tol=1e-6, max_iter=200):
"""
Calculates continued fraction of the incomplete beta function.
NOTE:
Inspired by: https://malishoaib.wordpress.com/2014/04/15/the-beautiful-beta-functions-in-raw-python/
Parameters
----------
x : array_like, shape (n,)
Variable to be evaluated
a : float
First parameter of beta function
b : float
Second parameter of beta function
Returns
-------
y : array_like, shape (n,)
Resulting value
"""
bm = az = am = np.ones_like(x)
qab = a + b
qap = a + 1.
qam = a - 1.
bz = 1. - qab * x / qap
i = 0
while i < max_iter:
em = float(i + 1)
tem = em + em
d = em * (b - em) * x / ((qam + tem) * (a + tem))
ap = az + d * am
bp = bz + d * bm
d = -(a + em) * (qab + em) * x / ((qap + tem) * (a + tem))
app = ap + d * az
bpp = bp + d * bz
aold = az
am = ap / bpp
bm = bp / bpp
az = app / bpp
bz = 1.
if np.all(np.abs(az - aold) < (tol * np.abs(az))):
return az
i += 1
raise ValueError('Unable to converge in maximum number of iterations.')
def betaincinv(y, a, b):
"""
Calculates the inverse of the incomplete beta function, i.e.::
B(x a, b) = 1 / B(a, b) * \int_0^x t^{a-1}(1-t)^{b-1} dt
solving for x as the upper bound of the integral using a Newton method
NOTE:
Inspired from: https://people.sc.fsu.edu/~jburkardt/f_src/asa109/asa109.html
Parameters
----------
y : float or array_like, shape (n,)
Variable to be evaluated
a : float or array_like, shape (n,)
First parameter of beta function
b : float or array_like, shape (n,)
Second parameter of beta function
Returns
-------
x : array_like, shape (n,)
Resulting value
"""
y, a, b = _chk_betainc_inp(y, a, b)
sae = -30.
fpu = 10. ** sae
shape = y.shape
x = y.flatten()
yy = y.flatten()
aa = a.flatten()
bb = b.flatten()
# change tail
it = np.argwhere(y > .5) # index of tail
yy[it] = 1. - y[it]
aa[it] = b[it]
bb[it] = a[it]
# Calculate the initial approximation
r = np.sqrt(-np.log(yy ** 2.))
z = r - (2.30753 + 0.27061 * r) / (1. + (0.99229 + 0.04481 * r) * r)
i = np.argwhere((aa > 1.) & (bb > 1.))
i_ = np.setdiff1d(np.arange(y.size), i)
s = t = h = w = np.zeros_like(y)
r[i] = (z[i] ** 2. - 3.) / 6.
s[i] = 1. / (2. * aa[i] - 1.)
t[i] = 1. / (2. * bb[i] - 1.)
h[i] = 2. / (s[i] + t[i])
w[i] = z[i] * np.sqrt(h[i] + r[i]) / h[i] - (t[i] - s[i]) * (r[i] + 5. / 6. - 2. / (3. * h[i]))
x[i] = aa[i] / (aa[i] + bb[i] * np.exp(2. * w[i]))
r[i_] = 2. * bb[i_]
t[i_] = 1. / (9. * bb[i_])
t[i_] = r[i_] * (1. - t[i_] + z[i_] * np.sqrt(t[i_])) ** 3.
betaln_ = betaln(a, b)
t[i_] = np.where(t[i_] <= 0., t[i_], (4. * aa[i_] + r[i_] - 2.) / t[i_])
x[i_] = np.where(t[i_] <= 0., 1. - np.exp((np.log((1. - yy[i_]) * bb[i_]) + betaln_[i_]) / bb[i_]),
np.where(t[i_] <= 1., np.exp((np.log(yy[i_] * aa[i_]) + betaln_[i_]) / aa[i_]),
1. - 2. / (t[i_] + 1.)))
# solve for x by a modified Newton-Raphson method, using the function betainc.
r = 1. - aa
t = 1. - bb
zprev = np.zeros_like(y)
sq = prev = np.ones_like(y)
# truncate initial value away from boundaries
x = np.clip(x, 0.0001, 0.9999)
iex = np.maximum(-5. / aa / aa - 1. / yy ** 0.2 - 13., sae)
acu = 10. ** iex
# iteration loop.
while True:
z = betainc(x, aa, bb)
xin = x
z = (z - yy) * np.exp(betaln_ + r * np.log(xin) + t * np.log(1. - xin))
prev = np.where(z * zprev <= 0., np.maximum(sq, fpu), prev)
g = 1.
while True:
while True:
adj = g * z
sq = adj ** 2.
tx = np.where(sq < prev, x - adj, x)
if np.all((0. <= tx) & (tx <= 1.)):
break
g /= 3.
# check whether current estimate is acceptable.
# the change "x = tx" was suggested by Ivan Ukhov.
x = np.where((prev <= acu) & (z ** 2. <= acu), tx, x)
if np.all((tx != 0.) & (tx != 1.0)):
break
g /= 3.
if np.all(tx == x):
break
x = tx
zprev = z
x[it] = 1. - x[it]
return np.reshape(x, shape)
|
/*
* SlappyParams.cc
*
* Created on: Jun 21, 2015
* Author: payne
*/
#include <stdio.h>
#include <stdlib.h>
#include "SlappyParams.h"
#include <boost/tokenizer.hpp>
#include <boost/program_options.hpp>
#include <boost/foreach.hpp>
#include <boost/algorithm/string.hpp>
#include "legion_tasks.h"
namespace po = boost::program_options;
void tokenize(const std::string& str, std::vector<int>& tokens, const std::string& delimiters)
{
// Skip delimiters at beginning.
std::string::size_type lastPos = str.find_first_not_of(delimiters, 0);
// Find first non-delimiter.
std::string::size_type pos = str.find_first_of(delimiters, lastPos);
while (std::string::npos != pos || std::string::npos != lastPos) {
// Found a token, add it to the vector.
std::istringstream tstream(str.substr(lastPos, pos - lastPos));
int tmp;
tstream >> tmp;
tokens.push_back(tmp);
// Skip delimiters.
lastPos = str.find_first_not_of(delimiters, pos);
// Find next non-delimiter.
pos = str.find_first_of(delimiters, lastPos);
}
}
namespace lli {
CommaSeparatedVector::CommaSeparatedVector(const std::initializer_list<int> _vals) : values(_vals) {}
CommaSeparatedVector::CommaSeparatedVector() {}
// comma separated values list
std::vector<int> values;
CommaSeparatedVector::operator std::string()
{
std::stringstream sstream;
for(auto val : values)
{
sstream << val << ",";
}
std::string res = sstream.str().substr(0,sstream.str().size()-1);
return res;
}
std::ostream& operator<<(std::ostream& out,const CommaSeparatedVector &value)
{
std::stringstream sstream;
for(auto val : value.values)
{
sstream << val << ",";
}
std::string res = sstream.str().substr(0,sstream.str().size()-1);
out << res;
return out;
}
// mapper for "lli::CommaSeparatedVector"
std::istream& operator>>(std::istream& in, CommaSeparatedVector &value)
{
std::string token;
in >> token;
tokenize(token, value.values);
return in;
}
}
SlappyParams::SlappyParams(const InputArgs &command_args) : noct(8)
{
using namespace std;
lli::CommaSeparatedVector global_dims({32,32,32});
lli::CommaSeparatedVector domain_dims({1,1,1});
// General Options
po::options_description gen("General Options");
gen.add_options()
("help", "produce help message")
;
po::options_description psize("Problem Size Options");
psize.add_options()
("global-dims", po::value<lli::CommaSeparatedVector>()->multitoken()->default_value(global_dims),
"global number of cells for each direction\nEx: --global-dims=nx,ny,nz")
("nx", po::value<int>(&nx)->default_value(128), "global number of cells in the x-direction")
("ny", po::value<int>(&ny)->default_value(128), "global number of cells in the y-direction")
("nz", po::value<int>(&nz)->default_value(128), "global number of cells in the z-direction")
("ng", po::value<int>(&ng)->default_value(16), "total number of velocity groups")
("nang", po::value<int>(&nang)->default_value(16), "total number of angles")
("nmom", po::value<int>(&nmom)->default_value(4), "total number of moments")
("nmat", po::value<int>(&nmat)->default_value(2), "total number of materials")
;
po::options_description dsize("Domain Decomposition Options");
dsize.add_options()
("domain-dims", po::value<lli::CommaSeparatedVector>()->multitoken()->default_value(domain_dims),
"number of domain chunks for each direction\nEx: --domain-dims=nCx,nCy,nCz")
("nCx", po::value<int>(&nCx)->default_value(1), "number of domain chunks in the x-direction")
("nCy", po::value<int>(&nCy)->default_value(1), "number of domain chunks in the y-direction")
("nCz", po::value<int>(&nCz)->default_value(1), "number of domain chunks in the z-direction")
;
// Declare an options description instance which will include
// all the options
po::options_description all("Allowed options");
all.add(gen).add(psize).add(dsize);
// Declare an options description instance which will be shown
// to the user
po::options_description visible("Allowed options");
visible.add(gen).add(psize).add(dsize);
po::variables_map vm;
po::command_line_parser parser(command_args.argc, command_args.argv);
parser = parser.options(all).style(po::command_line_style::unix_style
| po::command_line_style::allow_long_disguise
| po::command_line_style::long_allow_adjacent).allow_unregistered();
po::store(parser.run(), vm);
po::notify(vm);
if (vm.count("help")) {
std::stringstream stream;
stream << visible;
string helpMsg = stream.str ();
boost::algorithm::replace_all (helpMsg, "--", "-");
cout << helpMsg << endl;
return;
}
if(vm.count("global-dims"))
{
if(vm.count("nx") || vm.count("ny") || vm.count("nz"))
printf("-nx, -ny, or -nz used with -global-dims, -global-dims takes precedent\n");
std::vector<int> gdims = vm["global-dims"].as<lli::CommaSeparatedVector>().values;
switch(gdims.size())
{
case 0: printf("Warning, no global dims specified, using defaults\n");break;
case 1: nx = gdims[0]; printf("Warning, only nx specified, using defaults for ny and nz\n"); break;
case 2: nx = gdims[0];ny = gdims[1];printf("Warning, only nx and ny specified, using defaults for nz\n"); break;
case 3: nx = gdims[0];ny = gdims[1];nz = gdims[2];break;
default: break;
}
}
if(vm.count("domain-dims"))
{
std::vector<int> gdims = vm["domain-dims"].as<lli::CommaSeparatedVector>().values;
switch(gdims.size())
{
case 0: printf("Warning, no domain dims specified, using defaults\n");break;
case 1: nCx = gdims[0]; printf("Warning, only nCx specified, using defaults for nCy and nCz\n"); break;
case 2: nCx = gdims[0];nCy = gdims[1];printf("Warning, only nCx and nCy specified, using defaults for nCz\n"); break;
case 3: nCx = gdims[0];nCy = gdims[1];nCz = gdims[2];break;
default: break;
}
}
assert(nx > 0);
assert(ny > 0);
assert(nz > 0);
assert(nCx > 0);
assert(nCy > 0);
assert(nCz > 0);
// Make sure all chunks are the same size
assert(nx%nCx == 0);
assert(ny%nCy == 0);
assert(nz%nCz == 0);
nx_l = nx/nCx;
ny_l = ny/nCy;
nz_l = nz/nCz;
cmom=nmom*nmom;
nDiag = nx_l + ny_l + nz_l - 2;
dt = 1.0;
fixup = true;
dx = 1.0/nx;
dy = 1.0/ny;
dz = 1.0/nz;
ndimen = 3;
print();
}
void SlappyParams::print()
{
printf("====== Global Spatial Dimensions ======\n");
printf("nx: %i ny: %i nz: %i\n",nx,ny,nz);
printf("========== Physics Parameters =========\n");
printf("ng: %i nang: %i nmom: %i nmat: %i\n",ng,nang,nmom,nmat);
printf("======= Domain Decomp Dimensions ======\n");
printf("nCx: %i nCy: %i nCz: %i\n",nCx,nCy,nCz);
printf("======= Local Spatial Dimensions ======\n");
printf("nx_l: %i ny_l: %i nz_l: %i\n",nx_l,ny_l,nz_l);
}
std::map<std::pair<FieldID,FieldID>,PrivilegeMode> propagate_nested_regions_privs(Context ctx,HighLevelRuntime* rt,
LRWrapper parent,std::vector<FieldPrivlages> parent_privs)
{
std::map<std::pair<FieldID,FieldID>,PrivilegeMode> res;
std::vector<FieldID> fids;
for(auto fp : parent_privs)
{
fids.push_back(fp.fid);
}
PhysicalRegion pr;
bool mapped_pr = 1;
const Task* task = ctx->as_mappable_task();
for(auto fp : parent_privs)
{
bool mapped_pr = 1;
for(int i=0;i<task->regions.size();i++)
{
if(task->regions[i].region == parent.lr && task->regions[i].has_field_privilege(fp.fid))
{
pr = ctx->get_physical_region(i);
mapped_pr=0;
break;
}
}
if(mapped_pr)
{
RegionRequirement rr(parent.lr,READ_ONLY,SIMULTANEOUS,parent.lr);
rr.add_fields(fids);
pr = rt->map_region(ctx,rr);
}
LegionMatrix<LRWrapper> wrappers(parent,pr,fp.fid);
LRWrapper child = wrappers(0).cast();
std::vector<FieldID> child_fids;
child_fids.assign(child.fids,child.fids+child.nfields);
for(auto cfid : child_fids)
res[std::pair<FieldID,FieldID>(fp.fid,cfid)] = fp.priv;
// if(mapped_pr)
// rt->unmap_region(ctx,pr);
}
return res;
}
std::vector<RegionRequirement> propagate_nested_regions(Context ctx,HighLevelRuntime* rt,
LRWrapper parent,
std::map<std::pair<FieldID,FieldID>,PrivilegeMode> child_privs)
{
std::vector<FieldID> parent_fields;
parent_fields.assign(parent.fids,parent.fids+parent.nfields);
std::vector<RegionRequirement> res;
std::vector<FieldID> fids;
for(auto fp : parent_fields)
{
// printf("adding field %i\n",fp);
fids.push_back(fp);
}
PhysicalRegion pr;
bool mapped_pr = 1;
const Task* task = ctx->as_mappable_task();
for(auto fp : fids)
{
bool mapped_pr = 1;
for(int i=0;i<task->regions.size();i++)
{
if(task->regions[i].region == parent.lr && task->regions[i].has_field_privilege(fp))
{
pr = ctx->get_physical_region(i);
mapped_pr=0;
printf("Parent region is already mapped!\n");
break;
}
}
if(mapped_pr)
{
RegionRequirement rr(parent.lr,READ_ONLY,SIMULTANEOUS,parent.lr);
rr.add_fields(fids);
pr = rt->map_region(ctx,rr);
}
LegionMatrix<LRWrapper> wrappers(parent,pr,fp);
for(int i=0;i<parent.ntotal;i++)
{
std::map<PrivilegeMode,std::vector<FieldID>> priv_map;
LRWrapper child = wrappers(i).cast();
printf("child of field %i has %i fields\n",fp,child.nfields);
// We first need to build a map of which privileges get which fields
for(int it=0;it<child.nfields;it++)
{
if(child_privs.find(std::pair<FieldID,FieldID>(fp,child.fids[it])) != child_privs.end())
priv_map[child_privs[std::pair<FieldID,FieldID>(fp,child.fids[it])]].push_back(child.fids[it]);
}
// Create region requirements for all of the field privilege combinations that we need
for(auto priv : priv_map)
{
// printf("Adding region requirement for field %i with %i fields\n",fp,priv.second.size());
// RegionRequirement child_req(child.lr,priv.first,EXCLUSIVE,child.lr);
// child_req.add_fields(priv.second);
// child_req.flags |= NO_ACCESS_FLAG;
std::vector<FieldID> inst_fields;
std::set<FieldID> priv_fields(priv.second.begin(),priv.second.end());
RegionRequirement rr(child.lr,priv.first,EXCLUSIVE,child.lr);
rr.add_fields(priv.second,false);
rr.add_flags(NO_ACCESS_FLAG);
res.push_back(rr);
}
}
// if(mapped_pr)
// rt->unmap_region(ctx,pr);
}
return res;
}
int nTotal_from_region(Context ctx, HighLevelRuntime *runtime,LogicalRegion lr_in);
std::map<Color,std::vector<RegionRequirement>> distribute_nested_regions(Context ctx,HighLevelRuntime* rt,
LRWrapper parent,
std::map<std::pair<FieldID,FieldID>,PrivilegeMode> child_privs)
{
std::vector<FieldID> parent_fields;
parent_fields.assign(parent.fids,parent.fids+parent.nfields);
std::map<Color,std::vector<RegionRequirement>> res;
std::vector<FieldID> fids;
for(auto fp : parent_fields)
{
// printf("adding field %i\n",fp);
fids.push_back(fp);
}
PhysicalRegion pr;
const Task* task = ctx->as_mappable_task();
for(auto fp : fids)
{
bool mapped_pr = 1;
for(int i=0;i<task->regions.size();i++)
{
if(task->regions[i].region == parent.lr && task->regions[i].has_field_privilege(fp))
{
pr = ctx->get_physical_region(i);
mapped_pr=0;
printf("Parent region is already mapped!\n");
break;
}
}
if(mapped_pr)
{
RegionRequirement rr(parent.lr,READ_ONLY,SIMULTANEOUS,parent.lr);
rr.add_fields(fids);
pr = rt->map_region(ctx,rr);
}
LegionMatrix<LRWrapper> wrappers(parent,pr,fp);
for(int i=0;i<parent.ntotal;i++)
{
std::map<PrivilegeMode,std::vector<FieldID>> priv_map;
LRWrapper child = wrappers(i).cast();
printf("child of field %i has %i fields\n",fp,child.nfields);
// We first need to build a map of which privileges get which fields
for(int it=0;it<child.nfields;it++)
{
if(child_privs.find(std::pair<FieldID,FieldID>(fp,child.fids[it])) != child_privs.end())
priv_map[child_privs[std::pair<FieldID,FieldID>(fp,child.fids[it])]].push_back(child.fids[it]);
}
// Create region requirements for all of the field privilege combinations that we need
for(auto priv : priv_map)
{
// RegionRequirement child_req(child.lr,priv.first,EXCLUSIVE,child.lr);
// child_req.add_fields(priv.second);
//
// res[i].push_back(child_req);
std::vector<FieldID> inst_fields;
std::set<FieldID> priv_fields(priv.second.begin(),priv.second.end());
RegionRequirement rr(child.lr,priv.first,EXCLUSIVE,child.lr);
rr.add_fields(priv.second,true);
const char* lr_name;
rt->retrieve_name(rr.parent,lr_name);
printf("Adding region requirement for region %s field %i with %i fields for %i\n",lr_name,fp,priv.second.size(),i);
// rr.add_flags(NO_ACCESS_FLAG);
res[i].push_back(rr);
// (res[i].end()-1)->copy_without_mapping_info(rr);
}
// rt->destroy_index_partition(ctx,iPart);
}
// if(mapped_pr)
// rt->unmap_region(ctx,pr);
}
return res;
}
|
printenv = function (env = parent.frame()) {
frame = 1
while (! identical(env, baseenv())) {
name = environmentName(env)
name_display = sprintf('<environment: %s>', name)
default_display = capture.output(env)[1]
cat(default_display)
if (name_display != default_display) {
if (frame < sys.nframe() && ! is.null((fn = sys.function(frame)))) {
fn_env = environment(fn)
# Inside a function, print function name.
name = function_name(fn, fn_env)
}
cat(sprintf(' (%s)', name))
}
cat('\n')
env = parent.env(env)
frame = frame + 1
}
cat('<environment: base>\n')
}
function_name = function (definition, envir) {
candidates = as.character(lsf.str(envir))
mod_name = module_name(envir)
for (candidate in candidates)
if (identical(get(candidate, envir, mode = 'function'), definition))
return(paste(c(mod_name, candidate), collapse = '$'))
warning('No candidate function found, probably a bug')
}
|
State Before: α : Type u_1
β : Type ?u.308822
γ : Type ?u.308825
δ : α → Sort u_2
s : Finset α
f g : (i : α) → δ i
inst✝¹ : (j : α) → Decidable (j ∈ s)
inst✝ : DecidableEq α
i : α
hi : ¬i ∈ s
v : δ i
⊢ update (piecewise s f g) i v = piecewise s f (update g i v) State After: α : Type u_1
β : Type ?u.308822
γ : Type ?u.308825
δ : α → Sort u_2
s : Finset α
f g : (i : α) → δ i
inst✝¹ : (j : α) → Decidable (j ∈ s)
inst✝ : DecidableEq α
i : α
hi : ¬i ∈ s
v : δ i
⊢ piecewise s (update f i v) (update g i v) = piecewise s f (update g i v) Tactic: rw [update_piecewise] State Before: α : Type u_1
β : Type ?u.308822
γ : Type ?u.308825
δ : α → Sort u_2
s : Finset α
f g : (i : α) → δ i
inst✝¹ : (j : α) → Decidable (j ∈ s)
inst✝ : DecidableEq α
i : α
hi : ¬i ∈ s
v : δ i
⊢ piecewise s (update f i v) (update g i v) = piecewise s f (update g i v) State After: α : Type u_1
β : Type ?u.308822
γ : Type ?u.308825
δ : α → Sort u_2
s : Finset α
f g : (i : α) → δ i
inst✝¹ : (j : α) → Decidable (j ∈ s)
inst✝ : DecidableEq α
i : α
hi : ¬i ∈ s
v : δ i
j : α
hj : j ∈ s
⊢ j ≠ i Tactic: refine' s.piecewise_congr (fun j hj => update_noteq _ _ _) fun _ _ => rfl State Before: α : Type u_1
β : Type ?u.308822
γ : Type ?u.308825
δ : α → Sort u_2
s : Finset α
f g : (i : α) → δ i
inst✝¹ : (j : α) → Decidable (j ∈ s)
inst✝ : DecidableEq α
i : α
hi : ¬i ∈ s
v : δ i
j : α
hj : j ∈ s
⊢ j ≠ i State After: no goals Tactic: exact fun h => hi (h ▸ hj) |
Add LoadPath "../metatheory".
Require Import Coq.Arith.Wf_nat.
Require Import Coq.Logic.FunctionalExtensionality.
Require Import Coq.Program.Equality.
Require Export Metatheory.
Require Export LibLNgen.
Require Export STLC_ott.
(** NOTE: Auxiliary theorems are hidden in generated documentation.
In general, there is a [_rec] version of every lemma involving
[open] and [close]. *)
(* *********************************************************************** *)
(** * Induction principles for nonterminals *)
Scheme typ_ind' := Induction for typ Sort Prop.
Definition typ_mutind :=
fun H1 H2 H3 =>
typ_ind' H1 H2 H3.
Scheme typ_rec' := Induction for typ Sort Set.
Definition typ_mutrec :=
fun H1 H2 H3 =>
typ_rec' H1 H2 H3.
Scheme term_ind' := Induction for term Sort Prop.
Definition term_mutind :=
fun H1 H2 H3 H4 H5 =>
term_ind' H1 H2 H3 H4 H5.
Scheme term_rec' := Induction for term Sort Set.
Definition term_mutrec :=
fun H1 H2 H3 H4 H5 =>
term_rec' H1 H2 H3 H4 H5.
(* *********************************************************************** *)
(** * Close *)
Fixpoint close_term_wrt_term_rec (n1 : nat) (x1 : termvar) (e1 : term) {struct e1} : term :=
match e1 with
| term_var_f x2 => if (x1 == x2) then (term_var_b n1) else (term_var_f x2)
| term_var_b n2 => if (lt_ge_dec n2 n1) then (term_var_b n2) else (term_var_b (S n2))
| term_abs t1 e2 => term_abs t1 (close_term_wrt_term_rec (S n1) x1 e2)
| term_app e2 e3 => term_app (close_term_wrt_term_rec n1 x1 e2) (close_term_wrt_term_rec n1 x1 e3)
end.
Definition close_term_wrt_term x1 e1 := close_term_wrt_term_rec 0 x1 e1.
(* *********************************************************************** *)
(** * Size *)
Fixpoint size_typ (t1 : typ) {struct t1} : nat :=
match t1 with
| typ_base => 1
| typ_arrow t2 t3 => 1 + (size_typ t2) + (size_typ t3)
end.
Fixpoint size_term (e1 : term) {struct e1} : nat :=
match e1 with
| term_var_f x1 => 1
| term_var_b n1 => 1
| term_abs t1 e2 => 1 + (size_typ t1) + (size_term e2)
| term_app e2 e3 => 1 + (size_term e2) + (size_term e3)
end.
(* *********************************************************************** *)
(** * Degree *)
(** These define only an upper bound, not a strict upper bound. *)
Inductive degree_term_wrt_term : nat -> term -> Prop :=
| degree_wrt_term_term_var_f : forall n1 x1,
degree_term_wrt_term n1 (term_var_f x1)
| degree_wrt_term_term_var_b : forall n1 n2,
lt n2 n1 ->
degree_term_wrt_term n1 (term_var_b n2)
| degree_wrt_term_term_abs : forall n1 t1 e1,
degree_term_wrt_term (S n1) e1 ->
degree_term_wrt_term n1 (term_abs t1 e1)
| degree_wrt_term_term_app : forall n1 e1 e2,
degree_term_wrt_term n1 e1 ->
degree_term_wrt_term n1 e2 ->
degree_term_wrt_term n1 (term_app e1 e2).
Scheme degree_term_wrt_term_ind' := Induction for degree_term_wrt_term Sort Prop.
Definition degree_term_wrt_term_mutind :=
fun H1 H2 H3 H4 H5 =>
degree_term_wrt_term_ind' H1 H2 H3 H4 H5.
Hint Constructors degree_term_wrt_term : core lngen.
(* *********************************************************************** *)
(** * Local closure (version in [Set], induction principles) *)
Inductive lc_set_term : term -> Set :=
| lc_set_term_var_f : forall x1,
lc_set_term (term_var_f x1)
| lc_set_term_abs : forall t1 e1,
(forall x1 : termvar, lc_set_term (open_term_wrt_term e1 (term_var_f x1))) ->
lc_set_term (term_abs t1 e1)
| lc_set_term_app : forall e1 e2,
lc_set_term e1 ->
lc_set_term e2 ->
lc_set_term (term_app e1 e2).
Scheme lc_term_ind' := Induction for lc_term Sort Prop.
Definition lc_term_mutind :=
fun H1 H2 H3 H4 =>
lc_term_ind' H1 H2 H3 H4.
Scheme lc_set_term_ind' := Induction for lc_set_term Sort Prop.
Definition lc_set_term_mutind :=
fun H1 H2 H3 H4 =>
lc_set_term_ind' H1 H2 H3 H4.
Scheme lc_set_term_rec' := Induction for lc_set_term Sort Set.
Definition lc_set_term_mutrec :=
fun H1 H2 H3 H4 =>
lc_set_term_rec' H1 H2 H3 H4.
Hint Constructors lc_term : core lngen.
Hint Constructors lc_set_term : core lngen.
(* *********************************************************************** *)
(** * Body *)
Definition body_term_wrt_term e1 := forall x1, lc_term (open_term_wrt_term e1 (term_var_f x1)).
Hint Unfold body_term_wrt_term.
(* *********************************************************************** *)
(** * Tactic support *)
(** Additional hint declarations. *)
Hint Resolve @plus_le_compat : lngen.
(** Redefine some tactics. *)
Ltac default_case_split ::=
first
[ progress destruct_notin
| progress destruct_sum
| progress safe_f_equal
].
(* *********************************************************************** *)
(** * Theorems about [size] *)
Ltac default_auto ::= auto with arith lngen; tauto.
Ltac default_autorewrite ::= fail.
(* begin hide *)
Lemma size_typ_min_mutual :
(forall t1, 1 <= size_typ t1).
Proof.
apply_mutual_ind typ_mutind;
default_simp.
Qed.
(* end hide *)
Lemma size_typ_min :
forall t1, 1 <= size_typ t1.
Proof.
pose proof size_typ_min_mutual as H; intuition eauto.
Qed.
Hint Resolve size_typ_min : lngen.
(* begin hide *)
Lemma size_term_min_mutual :
(forall e1, 1 <= size_term e1).
Proof.
apply_mutual_ind term_mutind;
default_simp.
Qed.
(* end hide *)
Lemma size_term_min :
forall e1, 1 <= size_term e1.
Proof.
pose proof size_term_min_mutual as H; intuition eauto.
Qed.
Hint Resolve size_term_min : lngen.
(* begin hide *)
Lemma size_term_close_term_wrt_term_rec_mutual :
(forall e1 x1 n1,
size_term (close_term_wrt_term_rec n1 x1 e1) = size_term e1).
Proof.
apply_mutual_ind term_mutind;
default_simp.
Qed.
(* end hide *)
(* begin hide *)
Lemma size_term_close_term_wrt_term_rec :
forall e1 x1 n1,
size_term (close_term_wrt_term_rec n1 x1 e1) = size_term e1.
Proof.
pose proof size_term_close_term_wrt_term_rec_mutual as H; intuition eauto.
Qed.
Hint Resolve size_term_close_term_wrt_term_rec : lngen.
Hint Rewrite size_term_close_term_wrt_term_rec using solve [auto] : lngen.
(* end hide *)
Lemma size_term_close_term_wrt_term :
forall e1 x1,
size_term (close_term_wrt_term x1 e1) = size_term e1.
Proof.
unfold close_term_wrt_term; default_simp.
Qed.
Hint Resolve size_term_close_term_wrt_term : lngen.
Hint Rewrite size_term_close_term_wrt_term using solve [auto] : lngen.
(* begin hide *)
Lemma size_term_open_term_wrt_term_rec_mutual :
(forall e1 e2 n1,
size_term e1 <= size_term (open_term_wrt_term_rec n1 e2 e1)).
Proof.
apply_mutual_ind term_mutind;
default_simp.
Qed.
(* end hide *)
(* begin hide *)
Lemma size_term_open_term_wrt_term_rec :
forall e1 e2 n1,
size_term e1 <= size_term (open_term_wrt_term_rec n1 e2 e1).
Proof.
pose proof size_term_open_term_wrt_term_rec_mutual as H; intuition eauto.
Qed.
Hint Resolve size_term_open_term_wrt_term_rec : lngen.
(* end hide *)
Lemma size_term_open_term_wrt_term :
forall e1 e2,
size_term e1 <= size_term (open_term_wrt_term e1 e2).
Proof.
unfold open_term_wrt_term; default_simp.
Qed.
Hint Resolve size_term_open_term_wrt_term : lngen.
(* begin hide *)
Lemma size_term_open_term_wrt_term_rec_var_mutual :
(forall e1 x1 n1,
size_term (open_term_wrt_term_rec n1 (term_var_f x1) e1) = size_term e1).
Proof.
apply_mutual_ind term_mutind;
default_simp.
Qed.
(* end hide *)
(* begin hide *)
Lemma size_term_open_term_wrt_term_rec_var :
forall e1 x1 n1,
size_term (open_term_wrt_term_rec n1 (term_var_f x1) e1) = size_term e1.
Proof.
pose proof size_term_open_term_wrt_term_rec_var_mutual as H; intuition eauto.
Qed.
Hint Resolve size_term_open_term_wrt_term_rec_var : lngen.
Hint Rewrite size_term_open_term_wrt_term_rec_var using solve [auto] : lngen.
(* end hide *)
Lemma size_term_open_term_wrt_term_var :
forall e1 x1,
size_term (open_term_wrt_term e1 (term_var_f x1)) = size_term e1.
Proof.
unfold open_term_wrt_term; default_simp.
Qed.
Hint Resolve size_term_open_term_wrt_term_var : lngen.
Hint Rewrite size_term_open_term_wrt_term_var using solve [auto] : lngen.
(* *********************************************************************** *)
(** * Theorems about [degree] *)
Ltac default_auto ::= auto with lngen; tauto.
Ltac default_autorewrite ::= fail.
(* begin hide *)
Lemma degree_term_wrt_term_S_mutual :
(forall n1 e1,
degree_term_wrt_term n1 e1 ->
degree_term_wrt_term (S n1) e1).
Proof.
apply_mutual_ind degree_term_wrt_term_mutind;
default_simp.
Qed.
(* end hide *)
Lemma degree_term_wrt_term_S :
forall n1 e1,
degree_term_wrt_term n1 e1 ->
degree_term_wrt_term (S n1) e1.
Proof.
pose proof degree_term_wrt_term_S_mutual as H; intuition eauto.
Qed.
Hint Resolve degree_term_wrt_term_S : lngen.
Lemma degree_term_wrt_term_O :
forall n1 e1,
degree_term_wrt_term O e1 ->
degree_term_wrt_term n1 e1.
Proof.
induction n1; default_simp.
Qed.
Hint Resolve degree_term_wrt_term_O : lngen.
(* begin hide *)
Lemma degree_term_wrt_term_close_term_wrt_term_rec_mutual :
(forall e1 x1 n1,
degree_term_wrt_term n1 e1 ->
degree_term_wrt_term (S n1) (close_term_wrt_term_rec n1 x1 e1)).
Proof.
apply_mutual_ind term_mutind;
default_simp.
Qed.
(* end hide *)
(* begin hide *)
Lemma degree_term_wrt_term_close_term_wrt_term_rec :
forall e1 x1 n1,
degree_term_wrt_term n1 e1 ->
degree_term_wrt_term (S n1) (close_term_wrt_term_rec n1 x1 e1).
Proof.
pose proof degree_term_wrt_term_close_term_wrt_term_rec_mutual as H; intuition eauto.
Qed.
Hint Resolve degree_term_wrt_term_close_term_wrt_term_rec : lngen.
(* end hide *)
Lemma degree_term_wrt_term_close_term_wrt_term :
forall e1 x1,
degree_term_wrt_term 0 e1 ->
degree_term_wrt_term 1 (close_term_wrt_term x1 e1).
Proof.
unfold close_term_wrt_term; default_simp.
Qed.
Hint Resolve degree_term_wrt_term_close_term_wrt_term : lngen.
(* begin hide *)
Lemma degree_term_wrt_term_close_term_wrt_term_rec_inv_mutual :
(forall e1 x1 n1,
degree_term_wrt_term (S n1) (close_term_wrt_term_rec n1 x1 e1) ->
degree_term_wrt_term n1 e1).
Proof.
apply_mutual_ind term_mutind;
default_simp; eauto with lngen.
Qed.
(* end hide *)
(* begin hide *)
Lemma degree_term_wrt_term_close_term_wrt_term_rec_inv :
forall e1 x1 n1,
degree_term_wrt_term (S n1) (close_term_wrt_term_rec n1 x1 e1) ->
degree_term_wrt_term n1 e1.
Proof.
pose proof degree_term_wrt_term_close_term_wrt_term_rec_inv_mutual as H; intuition eauto.
Qed.
Hint Immediate degree_term_wrt_term_close_term_wrt_term_rec_inv : lngen.
(* end hide *)
Lemma degree_term_wrt_term_close_term_wrt_term_inv :
forall e1 x1,
degree_term_wrt_term 1 (close_term_wrt_term x1 e1) ->
degree_term_wrt_term 0 e1.
Proof.
unfold close_term_wrt_term; eauto with lngen.
Qed.
Hint Immediate degree_term_wrt_term_close_term_wrt_term_inv : lngen.
(* begin hide *)
Lemma degree_term_wrt_term_open_term_wrt_term_rec_mutual :
(forall e1 e2 n1,
degree_term_wrt_term (S n1) e1 ->
degree_term_wrt_term n1 e2 ->
degree_term_wrt_term n1 (open_term_wrt_term_rec n1 e2 e1)).
Proof.
apply_mutual_ind term_mutind;
default_simp.
Qed.
(* end hide *)
(* begin hide *)
Lemma degree_term_wrt_term_open_term_wrt_term_rec :
forall e1 e2 n1,
degree_term_wrt_term (S n1) e1 ->
degree_term_wrt_term n1 e2 ->
degree_term_wrt_term n1 (open_term_wrt_term_rec n1 e2 e1).
Proof.
pose proof degree_term_wrt_term_open_term_wrt_term_rec_mutual as H; intuition eauto.
Qed.
Hint Resolve degree_term_wrt_term_open_term_wrt_term_rec : lngen.
(* end hide *)
Lemma degree_term_wrt_term_open_term_wrt_term :
forall e1 e2,
degree_term_wrt_term 1 e1 ->
degree_term_wrt_term 0 e2 ->
degree_term_wrt_term 0 (open_term_wrt_term e1 e2).
Proof.
unfold open_term_wrt_term; default_simp.
Qed.
Hint Resolve degree_term_wrt_term_open_term_wrt_term : lngen.
(* begin hide *)
Lemma degree_term_wrt_term_open_term_wrt_term_rec_inv_mutual :
(forall e1 e2 n1,
degree_term_wrt_term n1 (open_term_wrt_term_rec n1 e2 e1) ->
degree_term_wrt_term (S n1) e1).
Proof.
apply_mutual_ind term_mutind;
default_simp; eauto with lngen.
Qed.
(* end hide *)
(* begin hide *)
Lemma degree_term_wrt_term_open_term_wrt_term_rec_inv :
forall e1 e2 n1,
degree_term_wrt_term n1 (open_term_wrt_term_rec n1 e2 e1) ->
degree_term_wrt_term (S n1) e1.
Proof.
pose proof degree_term_wrt_term_open_term_wrt_term_rec_inv_mutual as H; intuition eauto.
Qed.
Hint Immediate degree_term_wrt_term_open_term_wrt_term_rec_inv : lngen.
(* end hide *)
Lemma degree_term_wrt_term_open_term_wrt_term_inv :
forall e1 e2,
degree_term_wrt_term 0 (open_term_wrt_term e1 e2) ->
degree_term_wrt_term 1 e1.
Proof.
unfold open_term_wrt_term; eauto with lngen.
Qed.
Hint Immediate degree_term_wrt_term_open_term_wrt_term_inv : lngen.
(* *********************************************************************** *)
(** * Theorems about [open] and [close] *)
Ltac default_auto ::= auto with lngen brute_force; tauto.
Ltac default_autorewrite ::= fail.
(* begin hide *)
Lemma close_term_wrt_term_rec_inj_mutual :
(forall e1 e2 x1 n1,
close_term_wrt_term_rec n1 x1 e1 = close_term_wrt_term_rec n1 x1 e2 ->
e1 = e2).
Proof.
apply_mutual_ind term_mutind;
intros; match goal with
| |- _ = ?term => destruct term
end;
default_simp; eauto with lngen.
Qed.
(* end hide *)
(* begin hide *)
Lemma close_term_wrt_term_rec_inj :
forall e1 e2 x1 n1,
close_term_wrt_term_rec n1 x1 e1 = close_term_wrt_term_rec n1 x1 e2 ->
e1 = e2.
Proof.
pose proof close_term_wrt_term_rec_inj_mutual as H; intuition eauto.
Qed.
Hint Immediate close_term_wrt_term_rec_inj : lngen.
(* end hide *)
Lemma close_term_wrt_term_inj :
forall e1 e2 x1,
close_term_wrt_term x1 e1 = close_term_wrt_term x1 e2 ->
e1 = e2.
Proof.
unfold close_term_wrt_term; eauto with lngen.
Qed.
Hint Immediate close_term_wrt_term_inj : lngen.
(* begin hide *)
Lemma close_term_wrt_term_rec_open_term_wrt_term_rec_mutual :
(forall e1 x1 n1,
x1 `notin` fv_term e1 ->
close_term_wrt_term_rec n1 x1 (open_term_wrt_term_rec n1 (term_var_f x1) e1) = e1).
Proof.
apply_mutual_ind term_mutind;
default_simp.
Qed.
(* end hide *)
(* begin hide *)
Lemma close_term_wrt_term_rec_open_term_wrt_term_rec :
forall e1 x1 n1,
x1 `notin` fv_term e1 ->
close_term_wrt_term_rec n1 x1 (open_term_wrt_term_rec n1 (term_var_f x1) e1) = e1.
Proof.
pose proof close_term_wrt_term_rec_open_term_wrt_term_rec_mutual as H; intuition eauto.
Qed.
Hint Resolve close_term_wrt_term_rec_open_term_wrt_term_rec : lngen.
Hint Rewrite close_term_wrt_term_rec_open_term_wrt_term_rec using solve [auto] : lngen.
(* end hide *)
Lemma close_term_wrt_term_open_term_wrt_term :
forall e1 x1,
x1 `notin` fv_term e1 ->
close_term_wrt_term x1 (open_term_wrt_term e1 (term_var_f x1)) = e1.
Proof.
unfold close_term_wrt_term; unfold open_term_wrt_term; default_simp.
Qed.
Hint Resolve close_term_wrt_term_open_term_wrt_term : lngen.
Hint Rewrite close_term_wrt_term_open_term_wrt_term using solve [auto] : lngen.
(* begin hide *)
Lemma open_term_wrt_term_rec_close_term_wrt_term_rec_mutual :
(forall e1 x1 n1,
open_term_wrt_term_rec n1 (term_var_f x1) (close_term_wrt_term_rec n1 x1 e1) = e1).
Proof.
apply_mutual_ind term_mutind;
default_simp.
Qed.
(* end hide *)
(* begin hide *)
Lemma open_term_wrt_term_rec_close_term_wrt_term_rec :
forall e1 x1 n1,
open_term_wrt_term_rec n1 (term_var_f x1) (close_term_wrt_term_rec n1 x1 e1) = e1.
Proof.
pose proof open_term_wrt_term_rec_close_term_wrt_term_rec_mutual as H; intuition eauto.
Qed.
Hint Resolve open_term_wrt_term_rec_close_term_wrt_term_rec : lngen.
Hint Rewrite open_term_wrt_term_rec_close_term_wrt_term_rec using solve [auto] : lngen.
(* end hide *)
Lemma open_term_wrt_term_close_term_wrt_term :
forall e1 x1,
open_term_wrt_term (close_term_wrt_term x1 e1) (term_var_f x1) = e1.
Proof.
unfold close_term_wrt_term; unfold open_term_wrt_term; default_simp.
Qed.
Hint Resolve open_term_wrt_term_close_term_wrt_term : lngen.
Hint Rewrite open_term_wrt_term_close_term_wrt_term using solve [auto] : lngen.
(* begin hide *)
Lemma open_term_wrt_term_rec_inj_mutual :
(forall e2 e1 x1 n1,
x1 `notin` fv_term e2 ->
x1 `notin` fv_term e1 ->
open_term_wrt_term_rec n1 (term_var_f x1) e2 = open_term_wrt_term_rec n1 (term_var_f x1) e1 ->
e2 = e1).
Proof.
apply_mutual_ind term_mutind;
intros; match goal with
| |- _ = ?term => destruct term
end;
default_simp; eauto with lngen.
Qed.
(* end hide *)
(* begin hide *)
Lemma open_term_wrt_term_rec_inj :
forall e2 e1 x1 n1,
x1 `notin` fv_term e2 ->
x1 `notin` fv_term e1 ->
open_term_wrt_term_rec n1 (term_var_f x1) e2 = open_term_wrt_term_rec n1 (term_var_f x1) e1 ->
e2 = e1.
Proof.
pose proof open_term_wrt_term_rec_inj_mutual as H; intuition eauto.
Qed.
Hint Immediate open_term_wrt_term_rec_inj : lngen.
(* end hide *)
Lemma open_term_wrt_term_inj :
forall e2 e1 x1,
x1 `notin` fv_term e2 ->
x1 `notin` fv_term e1 ->
open_term_wrt_term e2 (term_var_f x1) = open_term_wrt_term e1 (term_var_f x1) ->
e2 = e1.
Proof.
unfold open_term_wrt_term; eauto with lngen.
Qed.
Hint Immediate open_term_wrt_term_inj : lngen.
(* *********************************************************************** *)
(** * Theorems about [lc] *)
Ltac default_auto ::= auto with lngen brute_force; tauto.
Ltac default_autorewrite ::= autorewrite with lngen.
(* begin hide *)
Lemma degree_term_wrt_term_of_lc_term_mutual :
(forall e1,
lc_term e1 ->
degree_term_wrt_term 0 e1).
Proof.
apply_mutual_ind lc_term_mutind;
intros;
let x1 := fresh "x1" in pick_fresh x1;
repeat (match goal with
| H1 : _, H2 : _ |- _ => specialize H1 with H2
end);
default_simp; eauto with lngen.
Qed.
(* end hide *)
Lemma degree_term_wrt_term_of_lc_term :
forall e1,
lc_term e1 ->
degree_term_wrt_term 0 e1.
Proof.
pose proof degree_term_wrt_term_of_lc_term_mutual as H; intuition eauto.
Qed.
Hint Resolve degree_term_wrt_term_of_lc_term : lngen.
(* begin hide *)
Lemma lc_term_of_degree_size_mutual :
forall i1,
(forall e1,
size_term e1 = i1 ->
degree_term_wrt_term 0 e1 ->
lc_term e1).
Proof.
intros i1; pattern i1; apply lt_wf_rec;
clear i1; intros i1 H1;
apply_mutual_ind term_mutind;
default_simp;
(* non-trivial cases *)
constructor; default_simp; eapply_first_hyp;
(* instantiate the size *)
match goal with
| |- _ = _ => reflexivity
| _ => idtac
end;
instantiate;
(* everything should be easy now *)
default_simp.
Qed.
(* end hide *)
Lemma lc_term_of_degree :
forall e1,
degree_term_wrt_term 0 e1 ->
lc_term e1.
Proof.
intros e1; intros;
pose proof (lc_term_of_degree_size_mutual (size_term e1));
intuition eauto.
Qed.
Hint Resolve lc_term_of_degree : lngen.
Ltac typ_lc_exists_tac :=
repeat (match goal with
| H : _ |- _ =>
fail 1
end).
Ltac term_lc_exists_tac :=
repeat (match goal with
| H : _ |- _ =>
let J1 := fresh in pose proof H as J1; apply degree_term_wrt_term_of_lc_term in J1; clear H
end).
Lemma lc_term_abs_exists :
forall x1 t1 e1,
lc_term (open_term_wrt_term e1 (term_var_f x1)) ->
lc_term (term_abs t1 e1).
Proof.
intros; term_lc_exists_tac; eauto with lngen.
Qed.
Hint Extern 1 (lc_term (term_abs _ _)) =>
let x1 := fresh in
pick_fresh x1;
apply (lc_term_abs_exists x1).
Lemma lc_body_term_wrt_term :
forall e1 e2,
body_term_wrt_term e1 ->
lc_term e2 ->
lc_term (open_term_wrt_term e1 e2).
Proof.
unfold body_term_wrt_term;
default_simp;
let x1 := fresh "x" in
pick_fresh x1;
specialize_all x1;
term_lc_exists_tac;
eauto with lngen.
Qed.
Hint Resolve lc_body_term_wrt_term : lngen.
Lemma lc_body_term_abs_2 :
forall t1 e1,
lc_term (term_abs t1 e1) ->
body_term_wrt_term e1.
Proof.
default_simp.
Qed.
Hint Resolve lc_body_term_abs_2 : lngen.
(* begin hide *)
Lemma lc_term_unique_mutual :
(forall e1 (proof2 proof3 : lc_term e1), proof2 = proof3).
Proof.
apply_mutual_ind lc_term_mutind;
intros;
let proof1 := fresh "proof1" in
rename_last_into proof1; dependent destruction proof1;
f_equal; default_simp; auto using @functional_extensionality_dep with lngen.
Qed.
(* end hide *)
Lemma lc_term_unique :
forall e1 (proof2 proof3 : lc_term e1), proof2 = proof3.
Proof.
pose proof lc_term_unique_mutual as H; intuition eauto.
Qed.
Hint Resolve lc_term_unique : lngen.
(* begin hide *)
Lemma lc_term_of_lc_set_term_mutual :
(forall e1, lc_set_term e1 -> lc_term e1).
Proof.
apply_mutual_ind lc_set_term_mutind;
default_simp.
Qed.
(* end hide *)
Lemma lc_term_of_lc_set_term :
forall e1, lc_set_term e1 -> lc_term e1.
Proof.
pose proof lc_term_of_lc_set_term_mutual as H; intuition eauto.
Qed.
Hint Resolve lc_term_of_lc_set_term : lngen.
(* begin hide *)
Lemma lc_set_term_of_lc_term_size_mutual :
forall i1,
(forall e1,
size_term e1 = i1 ->
lc_term e1 ->
lc_set_term e1).
Proof.
intros i1; pattern i1; apply lt_wf_rec;
clear i1; intros i1 H1;
apply_mutual_ind term_mutrec;
default_simp;
try solve [assert False by default_simp; tauto];
(* non-trivial cases *)
constructor; default_simp;
try first [apply lc_set_term_of_lc_term
| apply lc_set_typ_of_lc_typ];
default_simp; eapply_first_hyp;
(* instantiate the size *)
match goal with
| |- _ = _ => reflexivity
| _ => idtac
end;
instantiate;
(* everything should be easy now *)
default_simp.
Qed.
(* end hide *)
Lemma lc_set_term_of_lc_term :
forall e1,
lc_term e1 ->
lc_set_term e1.
Proof.
intros e1; intros;
pose proof (lc_set_term_of_lc_term_size_mutual (size_term e1));
intuition eauto.
Qed.
Hint Resolve lc_set_term_of_lc_term : lngen.
(* *********************************************************************** *)
(** * More theorems about [open] and [close] *)
Ltac default_auto ::= auto with lngen; tauto.
Ltac default_autorewrite ::= fail.
(* begin hide *)
Lemma close_term_wrt_term_rec_degree_term_wrt_term_mutual :
(forall e1 x1 n1,
degree_term_wrt_term n1 e1 ->
x1 `notin` fv_term e1 ->
close_term_wrt_term_rec n1 x1 e1 = e1).
Proof.
apply_mutual_ind term_mutind;
default_simp.
Qed.
(* end hide *)
(* begin hide *)
Lemma close_term_wrt_term_rec_degree_term_wrt_term :
forall e1 x1 n1,
degree_term_wrt_term n1 e1 ->
x1 `notin` fv_term e1 ->
close_term_wrt_term_rec n1 x1 e1 = e1.
Proof.
pose proof close_term_wrt_term_rec_degree_term_wrt_term_mutual as H; intuition eauto.
Qed.
Hint Resolve close_term_wrt_term_rec_degree_term_wrt_term : lngen.
Hint Rewrite close_term_wrt_term_rec_degree_term_wrt_term using solve [auto] : lngen.
(* end hide *)
Lemma close_term_wrt_term_lc_term :
forall e1 x1,
lc_term e1 ->
x1 `notin` fv_term e1 ->
close_term_wrt_term x1 e1 = e1.
Proof.
unfold close_term_wrt_term; default_simp.
Qed.
Hint Resolve close_term_wrt_term_lc_term : lngen.
Hint Rewrite close_term_wrt_term_lc_term using solve [auto] : lngen.
(* begin hide *)
Lemma open_term_wrt_term_rec_degree_term_wrt_term_mutual :
(forall e2 e1 n1,
degree_term_wrt_term n1 e2 ->
open_term_wrt_term_rec n1 e1 e2 = e2).
Proof.
apply_mutual_ind term_mutind;
default_simp.
Qed.
(* end hide *)
(* begin hide *)
Lemma open_term_wrt_term_rec_degree_term_wrt_term :
forall e2 e1 n1,
degree_term_wrt_term n1 e2 ->
open_term_wrt_term_rec n1 e1 e2 = e2.
Proof.
pose proof open_term_wrt_term_rec_degree_term_wrt_term_mutual as H; intuition eauto.
Qed.
Hint Resolve open_term_wrt_term_rec_degree_term_wrt_term : lngen.
Hint Rewrite open_term_wrt_term_rec_degree_term_wrt_term using solve [auto] : lngen.
(* end hide *)
Lemma open_term_wrt_term_lc_term :
forall e2 e1,
lc_term e2 ->
open_term_wrt_term e2 e1 = e2.
Proof.
unfold open_term_wrt_term; default_simp.
Qed.
Hint Resolve open_term_wrt_term_lc_term : lngen.
Hint Rewrite open_term_wrt_term_lc_term using solve [auto] : lngen.
(* *********************************************************************** *)
(** * Theorems about [fv] *)
Ltac default_auto ::= auto with set lngen; tauto.
Ltac default_autorewrite ::= autorewrite with lngen.
(* begin hide *)
Lemma fv_term_close_term_wrt_term_rec_mutual :
(forall e1 x1 n1,
fv_term (close_term_wrt_term_rec n1 x1 e1) [=] remove x1 (fv_term e1)).
Proof.
apply_mutual_ind term_mutind;
default_simp; fsetdec.
Qed.
(* end hide *)
(* begin hide *)
Lemma fv_term_close_term_wrt_term_rec :
forall e1 x1 n1,
fv_term (close_term_wrt_term_rec n1 x1 e1) [=] remove x1 (fv_term e1).
Proof.
pose proof fv_term_close_term_wrt_term_rec_mutual as H; intuition eauto.
Qed.
Hint Resolve fv_term_close_term_wrt_term_rec : lngen.
Hint Rewrite fv_term_close_term_wrt_term_rec using solve [auto] : lngen.
(* end hide *)
Lemma fv_term_close_term_wrt_term :
forall e1 x1,
fv_term (close_term_wrt_term x1 e1) [=] remove x1 (fv_term e1).
Proof.
unfold close_term_wrt_term; default_simp.
Qed.
Hint Resolve fv_term_close_term_wrt_term : lngen.
Hint Rewrite fv_term_close_term_wrt_term using solve [auto] : lngen.
(* begin hide *)
Lemma fv_term_open_term_wrt_term_rec_lower_mutual :
(forall e1 e2 n1,
fv_term e1 [<=] fv_term (open_term_wrt_term_rec n1 e2 e1)).
Proof.
apply_mutual_ind term_mutind;
default_simp; fsetdec.
Qed.
(* end hide *)
(* begin hide *)
Lemma fv_term_open_term_wrt_term_rec_lower :
forall e1 e2 n1,
fv_term e1 [<=] fv_term (open_term_wrt_term_rec n1 e2 e1).
Proof.
pose proof fv_term_open_term_wrt_term_rec_lower_mutual as H; intuition eauto.
Qed.
Hint Resolve fv_term_open_term_wrt_term_rec_lower : lngen.
(* end hide *)
Lemma fv_term_open_term_wrt_term_lower :
forall e1 e2,
fv_term e1 [<=] fv_term (open_term_wrt_term e1 e2).
Proof.
unfold open_term_wrt_term; default_simp.
Qed.
Hint Resolve fv_term_open_term_wrt_term_lower : lngen.
(* begin hide *)
Lemma fv_term_open_term_wrt_term_rec_upper_mutual :
(forall e1 e2 n1,
fv_term (open_term_wrt_term_rec n1 e2 e1) [<=] fv_term e2 `union` fv_term e1).
Proof.
apply_mutual_ind term_mutind;
default_simp; fsetdec.
Qed.
(* end hide *)
(* begin hide *)
Lemma fv_term_open_term_wrt_term_rec_upper :
forall e1 e2 n1,
fv_term (open_term_wrt_term_rec n1 e2 e1) [<=] fv_term e2 `union` fv_term e1.
Proof.
pose proof fv_term_open_term_wrt_term_rec_upper_mutual as H; intuition eauto.
Qed.
Hint Resolve fv_term_open_term_wrt_term_rec_upper : lngen.
(* end hide *)
Lemma fv_term_open_term_wrt_term_upper :
forall e1 e2,
fv_term (open_term_wrt_term e1 e2) [<=] fv_term e2 `union` fv_term e1.
Proof.
unfold open_term_wrt_term; default_simp.
Qed.
Hint Resolve fv_term_open_term_wrt_term_upper : lngen.
(* begin hide *)
Lemma fv_term_subst_term_fresh_mutual :
(forall e1 e2 x1,
x1 `notin` fv_term e1 ->
fv_term (subst_term e2 x1 e1) [=] fv_term e1).
Proof.
apply_mutual_ind term_mutind;
default_simp; fsetdec.
Qed.
(* end hide *)
Lemma fv_term_subst_term_fresh :
forall e1 e2 x1,
x1 `notin` fv_term e1 ->
fv_term (subst_term e2 x1 e1) [=] fv_term e1.
Proof.
pose proof fv_term_subst_term_fresh_mutual as H; intuition eauto.
Qed.
Hint Resolve fv_term_subst_term_fresh : lngen.
Hint Rewrite fv_term_subst_term_fresh using solve [auto] : lngen.
(* begin hide *)
Lemma fv_term_subst_term_lower_mutual :
(forall e1 e2 x1,
remove x1 (fv_term e1) [<=] fv_term (subst_term e2 x1 e1)).
Proof.
apply_mutual_ind term_mutind;
default_simp; fsetdec.
Qed.
(* end hide *)
Lemma fv_term_subst_term_lower :
forall e1 e2 x1,
remove x1 (fv_term e1) [<=] fv_term (subst_term e2 x1 e1).
Proof.
pose proof fv_term_subst_term_lower_mutual as H; intuition eauto.
Qed.
Hint Resolve fv_term_subst_term_lower : lngen.
(* begin hide *)
Lemma fv_term_subst_term_notin_mutual :
(forall e1 e2 x1 x2,
x2 `notin` fv_term e1 ->
x2 `notin` fv_term e2 ->
x2 `notin` fv_term (subst_term e2 x1 e1)).
Proof.
apply_mutual_ind term_mutind;
default_simp; fsetdec.
Qed.
(* end hide *)
Lemma fv_term_subst_term_notin :
forall e1 e2 x1 x2,
x2 `notin` fv_term e1 ->
x2 `notin` fv_term e2 ->
x2 `notin` fv_term (subst_term e2 x1 e1).
Proof.
pose proof fv_term_subst_term_notin_mutual as H; intuition eauto.
Qed.
Hint Resolve fv_term_subst_term_notin : lngen.
(* begin hide *)
Lemma fv_term_subst_term_upper_mutual :
(forall e1 e2 x1,
fv_term (subst_term e2 x1 e1) [<=] fv_term e2 `union` remove x1 (fv_term e1)).
Proof.
apply_mutual_ind term_mutind;
default_simp; fsetdec.
Qed.
(* end hide *)
Lemma fv_term_subst_term_upper :
forall e1 e2 x1,
fv_term (subst_term e2 x1 e1) [<=] fv_term e2 `union` remove x1 (fv_term e1).
Proof.
pose proof fv_term_subst_term_upper_mutual as H; intuition eauto.
Qed.
Hint Resolve fv_term_subst_term_upper : lngen.
(* *********************************************************************** *)
(** * Theorems about [subst] *)
Ltac default_auto ::= auto with lngen brute_force; tauto.
Ltac default_autorewrite ::= autorewrite with lngen.
(* begin hide *)
Lemma subst_term_close_term_wrt_term_rec_mutual :
(forall e2 e1 x1 x2 n1,
degree_term_wrt_term n1 e1 ->
x1 <> x2 ->
x2 `notin` fv_term e1 ->
subst_term e1 x1 (close_term_wrt_term_rec n1 x2 e2) = close_term_wrt_term_rec n1 x2 (subst_term e1 x1 e2)).
Proof.
apply_mutual_ind term_mutind;
default_simp.
Qed.
(* end hide *)
Lemma subst_term_close_term_wrt_term_rec :
forall e2 e1 x1 x2 n1,
degree_term_wrt_term n1 e1 ->
x1 <> x2 ->
x2 `notin` fv_term e1 ->
subst_term e1 x1 (close_term_wrt_term_rec n1 x2 e2) = close_term_wrt_term_rec n1 x2 (subst_term e1 x1 e2).
Proof.
pose proof subst_term_close_term_wrt_term_rec_mutual as H; intuition eauto.
Qed.
Hint Resolve subst_term_close_term_wrt_term_rec : lngen.
Lemma subst_term_close_term_wrt_term :
forall e2 e1 x1 x2,
lc_term e1 -> x1 <> x2 ->
x2 `notin` fv_term e1 ->
subst_term e1 x1 (close_term_wrt_term x2 e2) = close_term_wrt_term x2 (subst_term e1 x1 e2).
Proof.
unfold close_term_wrt_term; default_simp.
Qed.
Hint Resolve subst_term_close_term_wrt_term : lngen.
(* begin hide *)
Lemma subst_term_degree_term_wrt_term_mutual :
(forall e1 e2 x1 n1,
degree_term_wrt_term n1 e1 ->
degree_term_wrt_term n1 e2 ->
degree_term_wrt_term n1 (subst_term e2 x1 e1)).
Proof.
apply_mutual_ind term_mutind;
default_simp.
Qed.
(* end hide *)
Lemma subst_term_degree_term_wrt_term :
forall e1 e2 x1 n1,
degree_term_wrt_term n1 e1 ->
degree_term_wrt_term n1 e2 ->
degree_term_wrt_term n1 (subst_term e2 x1 e1).
Proof.
pose proof subst_term_degree_term_wrt_term_mutual as H; intuition eauto.
Qed.
Hint Resolve subst_term_degree_term_wrt_term : lngen.
(* begin hide *)
Lemma subst_term_fresh_eq_mutual :
(forall e2 e1 x1,
x1 `notin` fv_term e2 ->
subst_term e1 x1 e2 = e2).
Proof.
apply_mutual_ind term_mutind;
default_simp.
Qed.
(* end hide *)
Lemma subst_term_fresh_eq :
forall e2 e1 x1,
x1 `notin` fv_term e2 ->
subst_term e1 x1 e2 = e2.
Proof.
pose proof subst_term_fresh_eq_mutual as H; intuition eauto.
Qed.
Hint Resolve subst_term_fresh_eq : lngen.
Hint Rewrite subst_term_fresh_eq using solve [auto] : lngen.
(* begin hide *)
Lemma subst_term_fresh_same_mutual :
(forall e2 e1 x1,
x1 `notin` fv_term e1 ->
x1 `notin` fv_term (subst_term e1 x1 e2)).
Proof.
apply_mutual_ind term_mutind;
default_simp.
Qed.
(* end hide *)
Lemma subst_term_fresh_same :
forall e2 e1 x1,
x1 `notin` fv_term e1 ->
x1 `notin` fv_term (subst_term e1 x1 e2).
Proof.
pose proof subst_term_fresh_same_mutual as H; intuition eauto.
Qed.
Hint Resolve subst_term_fresh_same : lngen.
Hint Rewrite subst_term_fresh_same using solve [auto] : lngen.
(* begin hide *)
Lemma subst_term_fresh_mutual :
(forall e2 e1 x1 x2,
x1 `notin` fv_term e2 ->
x1 `notin` fv_term e1 ->
x1 `notin` fv_term (subst_term e1 x2 e2)).
Proof.
apply_mutual_ind term_mutind;
default_simp.
Qed.
(* end hide *)
Lemma subst_term_fresh :
forall e2 e1 x1 x2,
x1 `notin` fv_term e2 ->
x1 `notin` fv_term e1 ->
x1 `notin` fv_term (subst_term e1 x2 e2).
Proof.
pose proof subst_term_fresh_mutual as H; intuition eauto.
Qed.
Hint Resolve subst_term_fresh : lngen.
Hint Rewrite subst_term_fresh using solve [auto] : lngen.
Lemma subst_term_lc_term :
forall e1 e2 x1,
lc_term e1 ->
lc_term e2 ->
lc_term (subst_term e2 x1 e1).
Proof.
default_simp.
Qed.
Hint Resolve subst_term_lc_term : lngen.
(* begin hide *)
Lemma subst_term_open_term_wrt_term_rec_mutual :
(forall e3 e1 e2 x1 n1,
lc_term e1 ->
subst_term e1 x1 (open_term_wrt_term_rec n1 e2 e3) = open_term_wrt_term_rec n1 (subst_term e1 x1 e2) (subst_term e1 x1 e3)).
Proof.
apply_mutual_ind term_mutind;
default_simp.
Qed.
(* end hide *)
(* begin hide *)
Lemma subst_term_open_term_wrt_term_rec :
forall e3 e1 e2 x1 n1,
lc_term e1 ->
subst_term e1 x1 (open_term_wrt_term_rec n1 e2 e3) = open_term_wrt_term_rec n1 (subst_term e1 x1 e2) (subst_term e1 x1 e3).
Proof.
pose proof subst_term_open_term_wrt_term_rec_mutual as H; intuition eauto.
Qed.
Hint Resolve subst_term_open_term_wrt_term_rec : lngen.
(* end hide *)
Lemma subst_term_open_term_wrt_term :
forall e3 e1 e2 x1,
lc_term e1 ->
subst_term e1 x1 (open_term_wrt_term e3 e2) = open_term_wrt_term (subst_term e1 x1 e3) (subst_term e1 x1 e2).
Proof.
unfold open_term_wrt_term; default_simp.
Qed.
Hint Resolve subst_term_open_term_wrt_term : lngen.
Lemma subst_term_open_term_wrt_term_var :
forall e2 e1 x1 x2,
x1 <> x2 ->
lc_term e1 ->
open_term_wrt_term (subst_term e1 x1 e2) (term_var_f x2) = subst_term e1 x1 (open_term_wrt_term e2 (term_var_f x2)).
Proof.
intros; rewrite subst_term_open_term_wrt_term; default_simp.
Qed.
Hint Resolve subst_term_open_term_wrt_term_var : lngen.
(* begin hide *)
Lemma subst_term_spec_rec_mutual :
(forall e1 e2 x1 n1,
subst_term e2 x1 e1 = open_term_wrt_term_rec n1 e2 (close_term_wrt_term_rec n1 x1 e1)).
Proof.
apply_mutual_ind term_mutind;
default_simp.
Qed.
(* end hide *)
(* begin hide *)
Lemma subst_term_spec_rec :
forall e1 e2 x1 n1,
subst_term e2 x1 e1 = open_term_wrt_term_rec n1 e2 (close_term_wrt_term_rec n1 x1 e1).
Proof.
pose proof subst_term_spec_rec_mutual as H; intuition eauto.
Qed.
Hint Resolve subst_term_spec_rec : lngen.
(* end hide *)
Lemma subst_term_spec :
forall e1 e2 x1,
subst_term e2 x1 e1 = open_term_wrt_term (close_term_wrt_term x1 e1) e2.
Proof.
unfold close_term_wrt_term; unfold open_term_wrt_term; default_simp.
Qed.
Hint Resolve subst_term_spec : lngen.
(* begin hide *)
Lemma subst_term_subst_term_mutual :
(forall e1 e2 e3 x2 x1,
x2 `notin` fv_term e2 ->
x2 <> x1 ->
subst_term e2 x1 (subst_term e3 x2 e1) = subst_term (subst_term e2 x1 e3) x2 (subst_term e2 x1 e1)).
Proof.
apply_mutual_ind term_mutind;
default_simp.
Qed.
(* end hide *)
Lemma subst_term_subst_term :
forall e1 e2 e3 x2 x1,
x2 `notin` fv_term e2 ->
x2 <> x1 ->
subst_term e2 x1 (subst_term e3 x2 e1) = subst_term (subst_term e2 x1 e3) x2 (subst_term e2 x1 e1).
Proof.
pose proof subst_term_subst_term_mutual as H; intuition eauto.
Qed.
Hint Resolve subst_term_subst_term : lngen.
(* begin hide *)
Lemma subst_term_close_term_wrt_term_rec_open_term_wrt_term_rec_mutual :
(forall e2 e1 x1 x2 n1,
x2 `notin` fv_term e2 ->
x2 `notin` fv_term e1 ->
x2 <> x1 ->
degree_term_wrt_term n1 e1 ->
subst_term e1 x1 e2 = close_term_wrt_term_rec n1 x2 (subst_term e1 x1 (open_term_wrt_term_rec n1 (term_var_f x2) e2))).
Proof.
apply_mutual_ind term_mutrec;
default_simp.
Qed.
(* end hide *)
(* begin hide *)
Lemma subst_term_close_term_wrt_term_rec_open_term_wrt_term_rec :
forall e2 e1 x1 x2 n1,
x2 `notin` fv_term e2 ->
x2 `notin` fv_term e1 ->
x2 <> x1 ->
degree_term_wrt_term n1 e1 ->
subst_term e1 x1 e2 = close_term_wrt_term_rec n1 x2 (subst_term e1 x1 (open_term_wrt_term_rec n1 (term_var_f x2) e2)).
Proof.
pose proof subst_term_close_term_wrt_term_rec_open_term_wrt_term_rec_mutual as H; intuition eauto.
Qed.
Hint Resolve subst_term_close_term_wrt_term_rec_open_term_wrt_term_rec : lngen.
(* end hide *)
Lemma subst_term_close_term_wrt_term_open_term_wrt_term :
forall e2 e1 x1 x2,
x2 `notin` fv_term e2 ->
x2 `notin` fv_term e1 ->
x2 <> x1 ->
lc_term e1 ->
subst_term e1 x1 e2 = close_term_wrt_term x2 (subst_term e1 x1 (open_term_wrt_term e2 (term_var_f x2))).
Proof.
unfold close_term_wrt_term; unfold open_term_wrt_term; default_simp.
Qed.
Hint Resolve subst_term_close_term_wrt_term_open_term_wrt_term : lngen.
Lemma subst_term_term_abs :
forall x2 t1 e2 e1 x1,
lc_term e1 ->
x2 `notin` fv_term e1 `union` fv_term e2 `union` singleton x1 ->
subst_term e1 x1 (term_abs t1 e2) = term_abs (t1) (close_term_wrt_term x2 (subst_term e1 x1 (open_term_wrt_term e2 (term_var_f x2)))).
Proof.
default_simp.
Qed.
Hint Resolve subst_term_term_abs : lngen.
(* begin hide *)
Lemma subst_term_intro_rec_mutual :
(forall e1 x1 e2 n1,
x1 `notin` fv_term e1 ->
open_term_wrt_term_rec n1 e2 e1 = subst_term e2 x1 (open_term_wrt_term_rec n1 (term_var_f x1) e1)).
Proof.
apply_mutual_ind term_mutind;
default_simp.
Qed.
(* end hide *)
Lemma subst_term_intro_rec :
forall e1 x1 e2 n1,
x1 `notin` fv_term e1 ->
open_term_wrt_term_rec n1 e2 e1 = subst_term e2 x1 (open_term_wrt_term_rec n1 (term_var_f x1) e1).
Proof.
pose proof subst_term_intro_rec_mutual as H; intuition eauto.
Qed.
Hint Resolve subst_term_intro_rec : lngen.
Hint Rewrite subst_term_intro_rec using solve [auto] : lngen.
Lemma subst_term_intro :
forall x1 e1 e2,
x1 `notin` fv_term e1 ->
open_term_wrt_term e1 e2 = subst_term e2 x1 (open_term_wrt_term e1 (term_var_f x1)).
Proof.
unfold open_term_wrt_term; default_simp.
Qed.
Hint Resolve subst_term_intro : lngen.
(* *********************************************************************** *)
(** * "Restore" tactics *)
Ltac default_auto ::= auto; tauto.
Ltac default_autorewrite ::= fail.
|
theory prop_82
imports Main
"$HIPSTER_HOME/IsaHipster"
begin
datatype 'a list = Nil2 | Cons2 "'a" "'a list"
datatype ('a, 'b) Pair2 = Pair "'a" "'b"
datatype Nat = Z | S "Nat"
fun zip :: "'a list => 'b list => (('a, 'b) Pair2) list" where
"zip (Nil2) y = Nil2"
| "zip (Cons2 z x2) (Nil2) = Nil2"
| "zip (Cons2 z x2) (Cons2 x3 x4) = Cons2 (Pair z x3) (zip x2 x4)"
fun take :: "Nat => 'a list => 'a list" where
"take (Z) y = Nil2"
| "take (S z) (Nil2) = Nil2"
| "take (S z) (Cons2 x2 x3) = Cons2 x2 (take z x3)"
(*hipster zip take *)
datatype NPair = Pairn Nat Nat
datatype PList = PNil | PCons NPair PList
datatype Nlist = NNil | NCons Nat Nlist
fun ptake :: "Nat => PList => PList" where
"ptake Z xs = PNil"
| "ptake (S _) PNil = PNil"
| "ptake (S n) (PCons x xs) = PCons x (ptake n xs)"
fun ntake :: "Nat => Nlist => Nlist" where
"ntake (Z) y = NNil"
| "ntake (S z) (NNil) = NNil"
| "ntake (S z) (NCons x2 x3) = NCons x2 (ntake z x3)"
fun pzip :: "Nlist => Nlist => PList" where
"pzip (NNil) y = PNil"
| "pzip (NCons z x2) (NNil) = PNil"
| "pzip (NCons z x2) (NCons x3 x4) = PCons (Pairn z x3) (pzip x2 x4)"
lemma lemma_ai [thy_expl]: "take x3 Nil2 = Nil2"
by (hipster_induct_schemes take.simps)
lemma lemma_aj [thy_expl]: "take x3 (take x3 y3) = take x3 y3"
by (hipster_induct_schemes take.simps)
lemma lemma_ak [thy_expl]: "take (S x3) (take x3 y3) = take x3 y3"
by (hipster_induct_schemes take.simps)
lemma lemma_ab [thy_expl]: "zip Nil2 x1 = zip x1 Nil2"
by (hipster_induct_schemes zip.simps)
lemma lemma_ac [thy_expl]: "zip Nil2 x1 = zip y1 Nil2"
by (hipster_induct_schemes zip.simps)
(*hipster ptake ntake pzip*)
lemma lemma_a [thy_expl]: "pzip x1 NNil = PNil"
by (hipster_induct_schemes ptake.simps ntake.simps pzip.simps)
lemma lemma_aa [thy_expl]: "ntake x1 NNil = NNil"
by (hipster_induct_schemes ptake.simps ntake.simps pzip.simps)
lemma lemma_ad [thy_expl]: "ptake x1 PNil = PNil"
by (hipster_induct_schemes ptake.simps ntake.simps pzip.simps)
lemma lemma_ae [thy_expl]: "ntake x2 (ntake x2 y2) = ntake x2 y2"
by (hipster_induct_schemes ptake.simps ntake.simps pzip.simps)
lemma lemma_af [thy_expl]: "ptake x2 (ptake x2 y2) = ptake x2 y2"
by (hipster_induct_schemes ptake.simps ntake.simps pzip.simps)
lemma lemma_ag [thy_expl]: "ptake x19 (pzip y19 y19) = pzip y19 (ntake x19 y19)"
by (hipster_induct_schemes ptake.simps ntake.simps pzip.simps)
lemma lemma_ah [thy_expl]: "pzip (ntake x19 y19) y19 = pzip y19 (ntake x19 y19)"
by (hipster_induct_schemes ptake.simps ntake.simps pzip.simps)
lemma lemma_al [thy_expl]: "pzip (ntake x19 y19) (ntake x19 y19) = pzip y19 (ntake x19 y19)"
by (hipster_induct_schemes ptake.simps ntake.simps pzip.simps)
lemma lemma_am [thy_expl]: "ntake (S x2) (ntake x2 y2) = ntake x2 y2"
by (hipster_induct_schemes ptake.simps ntake.simps pzip.simps)
lemma lemma_an [thy_expl]: "ptake (S x2) (ptake x2 y2) = ptake x2 y2"
by (hipster_induct_schemes ptake.simps ntake.simps pzip.simps)
setup\<open>Hip_Tac_Ops.set_metis_to @{context} 10000\<close>
setup\<open>Hip_Tac_Ops.set_metis_filter @{context} (K false)\<close>
lemma lemma_ao [thy_expl]: "ptake x (pzip y z) = pzip y (ntake x z)"
by (hipster_induct_schemes PList.exhaust Nat.exhaust Nlist.exhaust ntake.simps ptake.simps pzip.simps)
(*
apply(induction y z arbitrary: x rule: pzip.induct)
apply simp_all
apply (metis PList.exhaust Nat.exhaust Nlist.exhaust ntake.simps ptake.simps pzip.simps)
apply (metis PList.exhaust Nat.exhaust Nlist.exhaust ntake.simps ptake.simps pzip.simps)
apply (metis PList.exhaust Nat.exhaust Nlist.exhaust ntake.simps ptake.simps pzip.simps)
done*)
(*
\<And>x. ptake x PNil = PNil
2. \<And>z x2 x. ptake x PNil = pzip (NCons z x2) (ntake x NNil)
3. \<And>z x2 x3 x4 x. (\<And>x. ptake x (pzip x2 x4) = pzip x2 (ntake x x4)) \<Longrightarrow> ptake x (PCons (Pairn z x3) (pzip x2 x4)) = pzip (NCons z x2) (ntake x (NCons x3 x4))
1. \<And>z x2 x. ptake x PNil = pzip (NCons z x2) (ntake x NNil)
2. \<And>z x2 x3 x4 x. (\<And>x. ptake x (pzip x2 x4) = pzip x2 (ntake x x4)) \<Longrightarrow> ptake x (PCons (Pairn z x3) (pzip x2 x4)) = pzip (NCons z x2) (ntake x (NCons x3 x4)
1. \<And>z x2 x3 x4 x. (\<And>x. ptake x (pzip x2 x4) = pzip x2 (ntake x x4)) \<Longrightarrow> ptake x (PCons (Pairn z x3) (pzip x2 x4)) = pzip (NCons z x2) (ntake x (NCons x3 x4))
*)
setup\<open>Hip_Tac_Ops.set_metis_to @{context} 5000\<close>
lemma lemma_ap [thy_expl]: "ntake x (ntake y z) = ntake y (ntake x z)"
by (hipster_induct_schemes PList.exhaust Nat.exhaust Nlist.exhaust ntake.simps ptake.simps pzip.simps)
lemma lemma_aq [thy_expl]: "ptake x (ptake y z) = ptake y (ptake x z)"
by (hipster_induct_schemes PList.exhaust Nat.exhaust Nlist.exhaust ntake.simps ptake.simps pzip.simps)
(* not found... for some reason *)
(*lemma lemma_ar [thy_expl]: "ptake x (pzip y z) = pzip (ntake x y) z"
by (hipster_induct_schemes PList.exhaust Nat.exhaust Nlist.exhaust ntake.simps ptake.simps pzip.simps)
setup{*Hip_Tac_Ops.set_metis_filter @{context} (K true)*}
lemma lemma_as [thy_expl]: "pzip (ntake x y) z = pzip y (ntake x z)"
by(metis thy_expl)*)
lemma unknown [thy_expl]: "pzip (ntake x y) (ntake z xa) = pzip (ntake z y) (ntake x xa)"
oops
lemma unknown [thy_expl]: "pzip (ntake x y) (ntake x z) = pzip y (ntake x z)"
oops(*by(metis thy_expl)*)
lemma unknown [thy_expl]: "pzip (ntake x y) (ntake z y) = pzip (ntake z y) (ntake x y)"
oops
(*
ML {* Induct.find_casesT @{context} @{typ "Nat"} *}
thm Nat.cases
thm Nat.exhaust
thm Nat.inject
thm Nat.distinct*)
(*hipster ptake pzip ntake*)
lemma lemma_ar [thy_expl]: "pzip (ntake x28 y28) z28 = pzip y28 (ntake x28 z28)"
by (hipster_induct_schemes ptake.simps pzip.simps ntake.simps PList.exhaust Nat.exhaust NPair.exhaust Nlist.exhaust)
lemma unknown [thy_expl]: "pzip (ntake x y) (ntake z xa) = pzip (ntake z y) (ntake x xa)"
oops
lemma unknown [thy_expl]: "pzip (ntake x y) (ntake x z) = pzip y (ntake x z)"
oops
lemma unknown [thy_expl]: "pzip (ntake x y) (ntake z y) = pzip (ntake z y) (ntake x y)"
oops
setup\<open>Hip_Tac_Ops.set_metis_filter @{context} (K true)\<close>
setup\<open>Hip_Tac_Ops.set_metis_to @{context} 400\<close>
theorem x0 :
"(ptake n (pzip xs ys)) = (pzip (ntake n xs) (ntake n ys))"
by (hipster_induct_schemes ptake.simps pzip.simps ntake.simps PList.exhaust Nat.exhaust NPair.exhaust Nlist.exhaust)
(*apply(induction xs ys arbitrary: n rule: pzip.induct)
apply(simp_all)
apply(metis ptake.simps pzip.simps ntake.simps thy_expl)
apply(metis pzip.simps take.simps ntake.simps ptake.simps NPair.exhaust Nat.exhaust PList.exhaust Nlist.exhaust)
sledgehammer
apply(metis thy_expl pzip.simps take.simps ntake.simps ptake.simps NPair.exhaust Nat.exhaust PList.exhaust Nlist.exhaust)
apply(case_tac n)
apply simp_all
done*)
fun len :: "Nlist \<Rightarrow> Nat" where
"len NNil = Z"
| "len (NCons _ xs) = S (len xs)"
fun append :: "Nlist => Nlist => Nlist" where
"append (NNil) y = y"
| "append (NCons z xs) y = NCons z (append xs y)"
fun rev :: "Nlist => Nlist" where
"rev (NNil) = NNil"
| "rev (NCons y xs) = append (rev xs) (NCons y (NNil))"
fun pappend :: "PList => PList => PList" where
"pappend (PNil) y = y"
| "pappend (PCons z xs) y = PCons z (pappend xs y)"
fun prev :: "PList => PList" where
"prev (PNil) = PNil"
| "prev (PCons y xs) = pappend (prev xs) (PCons y (PNil))"
hipster append rev len
lemma lemma_as [thy_expl]: "prop_82.append (prop_82.append x1 y1) z1 =
prop_82.append x1 (prop_82.append y1 z1)"
by (hipster_induct_schemes prop_82.append.simps prop_82.rev.simps prop_82.len.simps prop_82.Nlist.exhaust prop_82.Nat.exhaust)
lemma unknown [thy_expl]: "len (prop_82.append x y) = len (prop_82.append y x)"
oops
lemma miss[thy_expl]: "append x NNil = x"
by (hipster_induct_schemes prop_82.append.simps prop_82.rev.simps prop_82.len.simps prop_82.Nlist.exhaust prop_82.Nat.exhaust)
lemma withM_a [thy_expl]: "prop_82.append (prop_82.rev x) (prop_82.rev y) =
prop_82.rev (prop_82.append y x)"
by (hipster_induct_schemes prop_82.append.simps prop_82.rev.simps prop_82.len.simps prop_82.Nlist.exhaust prop_82.Nat.exhaust)
lemma withM_aa [thy_expl]: "prop_82.rev (prop_82.rev x) = x"
by (hipster_induct_schemes prop_82.append.simps prop_82.rev.simps )
lemma unknown [thy_expl]: "len (prop_82.rev x) = len x"
oops
hipster prev pappend
lemma lemma_at [thy_expl]: "pappend (pappend x1 y1) z1 = pappend x1 (pappend y1 z1)"
by (hipster_induct_schemes prop_82.prev.simps prop_82.pappend.simps prop_82.PList.exhaust prop_82.NPair.exhaust)
lemma miss_b[thy_expl]: "pappend x PNil = x"
by (hipster_induct_schemes prop_82.prev.simps prop_82.pappend.simps prop_82.PList.exhaust prop_82.NPair.exhaust)
lemma withM_ab [thy_expl]: "pappend (prev x) (prev y) = prev (pappend y x)"
by (hipster_induct_schemes prop_82.prev.simps prop_82.pappend.simps prop_82.PList.exhaust prop_82.NPair.exhaust)
lemma withM_ac [thy_expl]: "prev (prev x) = x"
by (hipster_induct_schemes prop_82.prev.simps prop_82.pappend.simps prop_82.PList.exhaust prop_82.NPair.exhaust)
hipster pzip pappend prev rev append len
lemma lemma_au [thy_expl]: "pzip x1 (prop_82.append x1 y1) = pzip x1 x1"
by (hipster_induct_schemes prop_82.pzip.simps prop_82.pappend.simps prop_82.prev.simps prop_82.rev.simps prop_82.append.simps prop_82.len.simps prop_82.PList.exhaust prop_82.Nlist.exhaust prop_82.Nat.exhaust prop_82.NPair.exhaust)
lemma lemma_av [thy_expl]: "pzip (prop_82.append x32 y32) x32 = pzip x32 x32"
by (hipster_induct_schemes prop_82.pzip.simps prop_82.pappend.simps prop_82.prev.simps prop_82.rev.simps prop_82.append.simps prop_82.len.simps prop_82.PList.exhaust prop_82.Nlist.exhaust prop_82.Nat.exhaust prop_82.NPair.exhaust)
lemma lemma_aw [thy_expl]: "pappend (pzip x1 x1) (pzip y1 z1) =
pzip (prop_82.append x1 y1) (prop_82.append x1 z1)"
by (hipster_induct_schemes prop_82.pzip.simps prop_82.pappend.simps prop_82.prev.simps prop_82.rev.simps prop_82.append.simps prop_82.len.simps prop_82.PList.exhaust prop_82.Nlist.exhaust prop_82.Nat.exhaust prop_82.NPair.exhaust)
lemma unknown [thy_expl]: "len (prop_82.append x y) = len (prop_82.append y x)"
oops
lemma unknown [thy_expl]: "len (prop_82.rev x) = len x"
oops
lemma unknown [thy_expl]: "pzip (prop_82.append x y) (prop_82.rev x) = pzip x (prop_82.rev x)"
oops
lemma unknown [thy_expl]: "pzip (prop_82.rev x) (prop_82.append x y) = pzip (prop_82.rev x) x"
oops
lemma unknown [thy_expl]: "pzip (prop_82.append x x) (prop_82.rev x) = pzip x (prop_82.rev x)"
oops
lemma unknown [thy_expl]: "pzip (prop_82.rev x) (prop_82.append x x) = pzip (prop_82.rev x) x"
oops
lemma unknown [thy_expl]: "pzip (prop_82.rev x) (prop_82.rev x) = prev (pzip x x)"
oops
theorem x1 :
"((len xs) = (len ys)) ==>
((pzip (rev xs) (rev ys)) = (prev (pzip xs ys)))"
apply(induction xs ys rule: pzip.induct)
apply simp
apply simp
apply simp+
sledgehammer
(*apply(metis pzip.simps prev.simps pappend.simps append.simps rev.simps)*)
by (tactic \<open>Subgoal.FOCUS_PARAMS (K (Tactic_Data.hard_tac @{context})) @{context} 1\<close>)
end
|
{-# OPTIONS --cubical --safe #-}
module Cubical.Modalities.Everything where
open import Cubical.Modalities.Modality public
|
#pragma once
#include <cstdint>
#include <functional>
#include <memory>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#include <gsl/gsl>
#include <nonstd/optional.hpp>
#include "chainerx/array_body.h"
#include "chainerx/array_fwd.h"
#include "chainerx/device.h"
#include "chainerx/dtype.h"
#include "chainerx/graph.h"
#include "chainerx/macro.h"
#include "chainerx/shape.h"
namespace chainerx {
class BackwardContext;
class Device;
using BackwardFunction = std::function<void(BackwardContext&)>;
namespace internal {
class ArrayNode;
class OpNode;
struct ArrayProps {
explicit ArrayProps(const Array& array);
explicit ArrayProps(const ArrayNode& array_node);
explicit ArrayProps(const ArrayBody& array_body);
Shape shape;
Dtype dtype;
Device& device;
};
class OpNodeBackwardEntry {
public:
OpNodeBackwardEntry(OpNode& op_node, std::vector<size_t> input_array_node_indices, BackwardFunction backward_func);
OpNode& op_node() const { return op_node_; }
size_t input_array_node_count() const { return input_array_node_indices_.size(); }
const std::vector<size_t>& input_array_node_indices() const { return input_array_node_indices_; }
const BackwardFunction& backward_func() const { return backward_func_; }
private:
friend class OpNode;
OpNode& op_node_;
// The index mapping from local (this backward function) to global (op node).
// Can be unset if the input array does not require grad.
std::vector<size_t> input_array_node_indices_;
BackwardFunction backward_func_;
};
// Creates an output array node at the specified index and adds edges between the output array node and the op node.
// Undefined behavior if the output array node already exists.
// This function is used by BackwardContext::GetRetainedOutput().
std::shared_ptr<ArrayNode> FabricateOutputArrayNode(std::shared_ptr<OpNode> op_node, size_t output_array_node_index);
class OpNode {
public:
// Creates a new op node that has output array nodes corresponding to the given outputs.
static std::shared_ptr<OpNode> CreateWithOutputArrayNodes(
std::string name, BackpropId backprop_id, size_t input_count, const std::vector<ConstArrayRef>& outputs);
OpNode(const OpNode&) = delete;
OpNode(OpNode&&) = delete;
OpNode& operator=(const OpNode&) = delete;
OpNode& operator=(OpNode&&) = delete;
OpNodeBackwardEntry& RegisterBackwardFunction(
std::vector<std::tuple<size_t, std::shared_ptr<ArrayNode>>> input_array_nodes, BackwardFunction backward_func);
// Adds links to input array nodes of other graphs.
// The size of the vector must be equal to the number of inputs.
void AddEdgesToInputArrayNodesOfOuterGraph(
const BackpropId& outer_backprop_id, std::vector<std::shared_ptr<ArrayNode>> outer_graphs_input_array_nodes);
// Adds links to output array nodes of other graphs.
// The size of the vector must be equal to the number of outputs.
void AddEdgesToOutputArrayNodesOfOuterGraph(
const BackpropId& outer_backprop_id, std::vector<std::shared_ptr<ArrayNode>> outer_graphs_output_array_nodes);
void Unchain() {
backward_entries_.clear();
std::fill(input_array_nodes_.begin(), input_array_nodes_.end(), std::shared_ptr<ArrayNode>{});
AssertConsistency();
}
bool HasInputArrayNode(size_t input_index) const { return input_array_nodes_[input_index] != nullptr; }
std::string name() const { return name_; }
std::vector<std::shared_ptr<ArrayNode>>& input_array_nodes();
const std::vector<std::shared_ptr<ArrayNode>>& input_array_nodes() const;
gsl::span<OpNodeBackwardEntry> backward_entries() { return backward_entries_; }
gsl::span<const OpNodeBackwardEntry> backward_entries() const { return backward_entries_; }
size_t input_array_node_count() const { return input_array_nodes_.size(); }
size_t output_array_node_count() const { return output_array_props_.size(); }
int64_t rank() const { return rank_; }
BackpropId backprop_id() const { return backprop_id_; }
const ArrayProps& GetOutputArrayProps(size_t i) const {
CHAINERX_ASSERT(i < output_array_props_.size());
return output_array_props_[i];
}
// Returns the list of output array nodes on "this" graph.
const std::vector<nonstd::optional<std::weak_ptr<ArrayNode>>>& output_array_nodes() const { return output_array_nodes_; }
// Returns the list of output array nodes on "this" graph.
std::vector<nonstd::optional<std::weak_ptr<ArrayNode>>>& output_array_nodes() { return output_array_nodes_; }
// Returns the input array nodes of all graphs.
const std::vector<std::tuple<BackpropId, std::vector<std::shared_ptr<ArrayNode>>>>& outer_graphs_input_array_nodes() const {
return outer_graphs_input_array_nodes_;
}
// Returns the output array nodes of all graphs.
const std::vector<std::tuple<BackpropId, std::vector<std::shared_ptr<ArrayNode>>>>& outer_graphs_output_array_nodes() const {
return outer_graphs_output_array_nodes_;
}
private:
OpNode(std::string name, BackpropId backprop_id, size_t input_array_node_count);
void AssertConsistency() const;
std::string name_;
// Backprop ID.
// Backprop ID is also held in the first entry of output_array_nodes_, but the reference to it may be invalidated, whereas this member
// is stable during the lifetime of this OpNode instance.
BackpropId backprop_id_;
int64_t rank_{0};
// List of input array nodes.
std::vector<std::shared_ptr<ArrayNode>> input_array_nodes_;
// List of output array nodes of this graph.
std::vector<nonstd::optional<std::weak_ptr<ArrayNode>>> output_array_nodes_;
// List of input/output array nodes of outer graphs.
// Outer graphs refer to graphs with lower ordinals.
// Each entry is a pair of backprop ID and list of input/output array nodes.
std::vector<std::tuple<BackpropId, std::vector<std::shared_ptr<ArrayNode>>>> outer_graphs_input_array_nodes_;
std::vector<std::tuple<BackpropId, std::vector<std::shared_ptr<ArrayNode>>>> outer_graphs_output_array_nodes_;
// Array props of output array nodes. This is used for creating dummy gradients.
std::vector<ArrayProps> output_array_props_;
std::vector<OpNodeBackwardEntry> backward_entries_;
};
} // namespace internal
} // namespace chainerx
|
# Aerospace Design via Quasiconvex Optimization
Consider a triangle, or a wedge, located within a hypersonic flow. A standard aerospace design optimization problem is to design the wedge to maximize the lift-to-drag ratio (L/D) (or conversely minimize the D/L ratio), subject to certain geometric constraints. In this example, the wedge is known to have a constant hypotenuse, and our job is to choose its width and height.
The drag-to-lift ratio is given by
\begin{equation}
\frac{\mathrm{D}}{\mathrm{L}} = \frac{\mathrm{c_d}}{\mathrm{c_l}},
\end{equation}
where $\mathrm{c_d}$ and $\mathrm{c_l}$ are drag and lift coefficients, respectively, that are obtained by integrating the projection of the pressure coefficient in directions parallel to, and perpendicular to, the body.
It turns out that the the drag-to-lift ratio is a quasilinear function, as we'll now show. We will assume the pressure coefficient is given by the Newtonian sine-squared law for whetted areas of the body,
\begin{equation}
\mathrm{c_p} = 2(\hat{v}\cdot\hat{n})^2
\end{equation}
and elsewhere $\mathrm{c_p} = 0$. Here, $\hat{v}$ is the free stream direction, which for simplicity we will assume is parallel to the body so that, $\hat{v} = \langle 1, 0 \rangle$, and $\hat{n}$ is the local unit normal. For a wedge defined by width $\Delta x$, and height $\Delta y$,
\begin{equation}
\hat{n} = \langle -\Delta y/s,-\Delta x/s \rangle
\end{equation}
where $s$ is the hypotenuse length. Therefore,
\begin{equation}
\mathrm{c_p} = 2((1)(-\Delta y/s)+(0)(-\Delta x/s))^2 = \frac{2 \Delta y^2}{s^2}
\end{equation}
The lift and drag coefficients are given by
\begin{align*}
\mathrm{c_d} &= \frac{1}{c}\int_0^s -\mathrm{c_p}\hat{n}_x \mathrm{d}s \\
\mathrm{c_l} &= \frac{1}{c}\int_0^s -\mathrm{c_p}\hat{n}_y \mathrm{d}s
\end{align*}
Where $c$ is the reference chord length of the body. Given that $\hat{n}$, and therefore $\mathrm{c_p}$ are constant over the whetted surface of the body,
\begin{align*}
\mathrm{c_d} &= -\frac{s}{c}\mathrm{c_p}\hat{n}_x = \frac{s}{c}\frac{2 \Delta y^2}{s^2}\frac{\Delta y}{s} \\
\mathrm{c_l} &= -\frac{s}{c}\mathrm{c_p}\hat{n}_y = \frac{s}{c}\frac{2 \Delta y^2}{s^2}\frac{\Delta x}{s}
\end{align*}
Assuming $s=1$, so that $\Delta y = \sqrt{1-\Delta x^2}$, plugging in the above into the equation for $D/L$, we obtain
\begin{equation}
\frac{\mathrm{D}}{\mathrm{L}} = \frac{\Delta y}{\Delta x} = \frac{\sqrt{1-\Delta x^2}}{\Delta x} = \sqrt{\frac{1}{\Delta x^2}-1}.
\end{equation}
This function is representable as a DQCP, quasilinear function. We plot it below, and then we write it using DQCP.
```
%matplotlib inline
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
import math
x = np.linspace(.25,1,num=201)
obj = []
for i in range(len(x)):
obj.append(math.sqrt(1/x[i]**2-1))
plt.plot(x,obj)
```
```
import cvxpy as cp
x = cp.Variable(pos=True)
obj = cp.sqrt(cp.inv_pos(cp.square(x))-1)
print("This objective function is", obj.curvature)
```
This objective function is QUASILINEAR
Minimizing this objective function subject to constraints representing payload requirements is a standard aerospace design problem. In this case we will consider the constraint that the wedge must be able to contain a rectangle of given length and width internally along its hypotenuse. This is representable as a convex constraint.
```
a = .05 # USER INPUT: height of rectangle, should be at most b
b = .65 # USER INPUT: width of rectangle
constraint = [a*cp.inv_pos(x)-(1-b)*cp.sqrt(1-cp.square(x))<=0]
print(constraint)
```
[Inequality(Expression(CONVEX, UNKNOWN, ()))]
```
prob = cp.Problem(cp.Minimize(obj), constraint)
prob.solve(qcp=True, verbose=True)
print('Final L/D Ratio = ', 1/obj.value)
print('Final width of wedge = ', x.value)
print('Final height of wedge = ', math.sqrt(1-x.value**2))
```
********************************************************************************
Preparing to bisect problem
minimize 0.0
subject to 0.05 * var30766 + -0.35 * var30793 <= 0.0
SOC(reshape(var30747 + var30766, (1,)), Vstack(reshape(var30747 + -var30766, (1, 1)), reshape(2.0 * 1.0, (1, 1))))
SOC(reshape(var30779 + 1.0, (1,)), Vstack(reshape(var30779 + -1.0, (1, 1)), reshape(2.0 * var30747, (1, 1))))
SOC(reshape(1.0 + -var30779 + 1.0, (1,)), Vstack(reshape(1.0 + -var30779 + -1.0, (1, 1)), reshape(2.0 * var30793, (1, 1))))
power(power(power(param30811, 2) + --1.0, -1), 1/2) <= var30747
Finding interval for bisection ...
initial lower bound: 0.000000
initial upper bound: 1.000000
(iteration 0) lower bound: 0.000000
(iteration 0) upper bound: 1.000000
(iteration 0) query point: 0.500000
(iteration 0) query was feasible. Solution(status=optimal, opt_val=0.0, primal_vars={30766: array(1.28425055), 30793: array(0.32048066), 30747: 0.9203698369509382, 30779: array(0.86287821)}, dual_vars={30764: 1.184352986830617e-10, 30775: array([ 7.68139086e-12, -9.11799720e-13, -6.85059567e-12]), 30788: array([ 6.73308751e-11, 7.50722737e-12, -6.55220021e-11]), 30802: array([ 4.04979217e-11, 3.43109122e-11, -1.68754271e-11]), 30835: 1.4165742899966837e-10}, attr={'solve_time': 6.0109e-05, 'setup_time': 4.4997e-05, 'num_iters': 7}))
(iteration 5) lower bound: 0.125000
(iteration 5) upper bound: 0.156250
(iteration 5) query point: 0.140625
(iteration 5) query was infeasible.
(iteration 10) lower bound: 0.145508
(iteration 10) upper bound: 0.146484
(iteration 10) query point: 0.145996
(iteration 10) query was feasible. Solution(status=optimal, opt_val=0.0, primal_vars={30766: array(1.01067238), 30793: array(0.14440604), 30747: 0.9895144829793, 30779: array(0.97914383)}, dual_vars={30764: 1.2610785752467482e-05, 30775: array([ 6.37367039e-07, 6.73702792e-09, -6.37322961e-07]), 30788: array([ 1.50627898e-05, 1.58286953e-07, -1.50619494e-05]), 30802: array([ 7.77053008e-06, 7.45051237e-06, -2.20683981e-06]), 30835: 2.948014872712083e-05}, attr={'solve_time': 0.000114922, 'setup_time': 3.6457e-05, 'num_iters': 10}))
(iteration 15) lower bound: 0.145874
(iteration 15) upper bound: 0.145905
(iteration 15) query point: 0.145889
(iteration 15) query was infeasible.
Bisection completed, with lower bound 0.145897 and upper bound 0.1458979
********************************************************************************
Final L/D Ratio = 6.854107648695203
Final width of wedge = 0.9895238539767502
Final height of wedge = 0.14436946495363565
Once the solution has been found, we can create a plot to verify that the rectangle is inscribed within the wedge.
```
y = math.sqrt(1-x.value**2)
lambda1 = a*x.value/y
lambda2 = a*x.value**2/y+a*y
lambda3 = a*x.value-y*(a*x.value/y-b)
plt.plot([0,x.value],[0,0],'b.-')
plt.plot([0,x.value],[0,-y],'b.-')
plt.plot([x.value,x.value],[0,-y],'b.-')
pt1 = [lambda1*x.value,-lambda1*y]
pt2 = [(lambda1+b)*x.value,-(lambda1+b)*y]
pt3 = [(lambda1+b)*x.value+a*y,-(lambda1+b)*y+a*x.value]
pt4 = [lambda1*x.value+a*y,-lambda1*y+a*x.value]
plt.plot([pt1[0],pt2[0]],[pt1[1],pt2[1]],'r.-')
plt.plot([pt2[0],pt3[0]],[pt2[1],pt3[1]],'r.-')
plt.plot([pt3[0],pt4[0]],[pt3[1],pt4[1]],'r.-')
plt.plot([pt4[0],pt1[0]],[pt4[1],pt1[1]],'r.-')
plt.axis('equal')
```
|
#ifndef TWITTERLIB_OBJECTS_COORDINATES_HPP
#define TWITTERLIB_OBJECTS_COORDINATES_HPP
#include <string>
#include <boost/property_tree/ptree_fwd.hpp>
namespace twitter {
struct Earth_coordinates {
float longitude = 0.f;
float latitude = 0.f;
};
/// Generates a string display of all data in \p ec.
[[nodiscard]] auto to_string(Earth_coordinates const& ec) -> std::string;
/// Create an Earth_coordinates struct from a property tree.
[[nodiscard]] auto parse_earth_coordinates(
boost::property_tree::ptree const& tree) -> Earth_coordinates;
struct Coordinates {
Earth_coordinates coordinates;
std::string type;
};
/// Generates a string display of all data in \p coordinates.
[[nodiscard]] auto to_string(Coordinates const& coordinates) -> std::string;
/// Create a Coordinates struct from a property tree.
[[nodiscard]] auto parse_coordinates(boost::property_tree::ptree const& tree)
-> Coordinates;
} // namespace twitter
#endif // TWITTERLIB_OBJECTS_COORDINATES_HPP
|
%MDL_IRB140 Create model of ABB IRB 140 manipulator
%
% MDL_IRB140 is a script that creates the workspace variable irb140 which
% describes the kinematic characteristics of an ABB IRB 140 manipulator
% using standard DH conventions.
%
% Also define the workspace vectors:
% qz zero joint angle configuration
% qr vertical 'READY' configuration
% qd lower arm horizontal as per data sheet
%
% Reference::
% - "IRB 140 data sheet", ABB Robotics.
% - "Utilizing the Functional Work Space Evaluation Tool for Assessing a
% System Design and Reconfiguration Alternatives"
% A. Djuric and R. J. Urbanic
%
% Notes::
% - SI units of metres are used.
% - Unlike most other mdl_xxx scripts this one is actually a function that
% behaves like a script and writes to the global workspace.
%
% See also mdl_fanuc10l, mdl_m16, mdl_motormanHP6, mdl_S4ABB2p8, mdl_puma560, SerialLink.
% MODEL: ABB, IRB140, 6DOF, standard_DH
% Copyright (C) 1993-2017, by Peter I. Corke
%
% This file is part of The Robotics Toolbox for MATLAB (RTB).
%
% RTB is free software: you can redistribute it and/or modify
% it under the terms of the GNU Lesser General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% RTB is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU Lesser General Public License for more details.
%
% You should have received a copy of the GNU Leser General Public License
% along with RTB. If not, see <http://www.gnu.org/licenses/>.
%
% http://www.petercorke.com
function r = mdl_irb140()
deg = pi/180;
% robot length values (metres)
d1 = 0.352;
a1 = 0.070;
a2 = 0.360;
d4 = 0.380;
d6 = 0.065;
% DH parameter table
% theta d a alpha
dh = [0 d1 a1 -pi/2
0 0 a2 0
0 0 0 pi/2
0 d4 0 -pi/2
0 0 0 pi/2
0 d6 0 pi/2];
% and build a serial link manipulator
robot = SerialLink(dh, 'name', 'IRB 140', ...
'manufacturer', 'ABB', 'ikine', 'nooffset');
% place the variables into the global workspace
if nargin == 1
r = robot;
elseif nargin == 0
assignin('caller', 'irb140', robot);
assignin('caller', 'qz', [0 0 0 0 0 0]); % zero angles
assignin('caller', 'qd', [0 -90 180 0 0 -90]*deg); % data sheet pose, horizontal
assignin('caller', 'qr', [0 -90 90 0 90 -90]*deg); % ready pose, arm up
end
end
|
-- ---------------------------------------------------------------- [ Main.idr ]
-- Module : Main.idr
-- Copyright : (c) Jan de Muijnck-Hughes
-- License : see LICENSE
-- --------------------------------------------------------------------- [ EOH ]
||| Serialiser and Parser and Evaluator for GLANG, quick and dirty.
module GRL.Lang.GLang.Main
import System
import Effects
import Effect.System
import Effect.StdIO
import Effect.State
import Effect.Exception
import Effect.File
import Data.AVL.Dict
import Lightyear
import Lightyear.Char
import Lightyear.Strings
import Lightyear.StringFile
import GRL.Lang.GLang
import GRL.Lang.GLang.Pretty
import GRL.Lang.Common.Error
import GRL.Lang.Common.Parser
import GRL.Lang.Common.Effs
import GRL.Lang.Common.Utils
import GRL.Eval
GLangE : Type -> Type
GLangE ty = Lang (GLang ELEM) ty
-- ------------------------------------------------------------------- [ Types ]
nodeTy : Parser GElemTy
nodeTy = (keyword "Goal" *> return GOALty)
<|> (keyword "Soft" *> return SOFTty)
<|> (keyword "Task" *> return TASKty)
<|> (keyword "Res" *> return RESty)
<?> "Node Type"
intentTy : Parser GIntentTy
intentTy = (keyword "==>" *> return IMPACTSty)
<|> (keyword "~~>" *> return AFFECTSty)
<?> "Intent Type"
structTy : Parser GStructTy
structTy = (keyword "&=" *> return ANDty)
<|> (keyword "|=" *> return IORty)
<|> (keyword "X=" *> return XORty)
<?> "Struct Type"
-- --------------------------------------------------------- [ Data Structures ]
node : Parser (GLangAST ELEM)
node = do
n <- ident
keyword "<-"
ty <- nodeTy
t <- quoted '"'
sval <- opt $ keyword "is" *> sValue
gComment
pure (MkNode n ty t sval)
<?> "Node"
intent : Parser (GLangAST INTENT)
intent = do
x <- ident
ty <- intentTy
y <- ident
keyword "|"
cval <- cValue
gComment
pure (MkIntent ty cval x y)
<?> "Intent"
struct : Parser (GLangAST STRUCT)
struct = do
x <- ident
ty <- structTy
ys <- brackets $ commaSep1 ident
gComment
pure (MkStruct ty x ys)
<?> "Struct"
-- ------------------------------------------------------- [ Model description ]
glang : Parser (ts ** DList GTy GLangAST ts)
glang = do
gComment
keyword "grl"
keyword "model"
gComment
ns <- some node
ss <- many struct
is <- many intent
let ns' = DList.fromList ns
let ss' = DList.fromList ss
let is' = DList.fromList is
pure (_ ** (snd ns')
++ (snd ss')
++ (snd is'))
<?> "GRL Model"
-- ----------------------------------------------------------- [ Strategy File ]
gstrategy : Parser $ List (String, SValue)
gstrategy = do
gComment
keyword "grl"
keyword "strategy"
gComment
ss <- some pairing
pure ss
<?> "Strategy"
where
pairing : Parser (String, SValue)
pairing = do
i <- ident
keyword "="
sval <- sValue
gComment
pure (i,sval)
-- --------------------------------------------------------- [ Effectful Stuff ]
buildElem : GElemTy -> String -> GLangE (GLang ELEM)
buildElem GOALty t = pure $ mkGoal t
buildElem SOFTty t = pure $ mkSoft t
buildElem TASKty t = pure $ mkTask t
buildElem RESty t = pure $ mkRes t
buildElemSat : GElemTy -> String -> SValue -> GLangE (GLang ELEM)
buildElemSat GOALty t s = pure $ mkSatGoal t s
buildElemSat SOFTty t s = pure $ mkSatSoft t s
buildElemSat TASKty t s = pure $ mkSatTask t s
buildElemSat RESty t s = pure $ mkSatRes t s
insertE : GLangAST ty -> GModel -> GLangE GModel
insertE (MkNode i ty t Nothing) m = do
g <- buildElem ty t
update (\env => insert i g env)
pure (insert g m)
insertE (MkNode i ty t (Just sval)) m = do
g <- buildElemSat ty t sval
update (\env => insert i g env)
pure (insert g m)
insertE (MkIntent ty cval x y) m = do
x' <- getElem x
y' <- getElem y
case ty of
IMPACTSty => pure $ insert (x' ==> y' | cval) m
AFFECTSty => pure $ insert (x' ~~> y' | cval) m
insertE (MkStruct ty x ys) m = do
x' <- getElem x
ys' <- mapE (\y => getElem y) ys
case ty of
ANDty => pure $ insert (x' &= ys') m
XORty => pure $ insert (x' X= ys') m
IORty => pure $ insert (x' |= ys') m
buildModel : DList GTy GLangAST ds -> GModel -> GLangE GModel
buildModel Nil m = pure m
buildModel (d::ds) m = buildModel ds !(insertE d m)
buildStrategyE : List (String, SValue) -> GLangE Strategy
buildStrategyE is = do
is' <- mapE (\x => doConv x) is
pure $ buildStrategy is'
where
doConv : (String,SValue) -> GLangE (GLang ELEM, SValue)
doConv (i,sval) = pure (!(getElem i), sval)
doEvaluateE : GModel
-> Maybe String
-> GLangE EvalResult
doEvaluateE m Nothing = evaluateE m Nothing
doEvaluateE m (Just sfname) = do
strat <- readLangFile gstrategy sfname
strat' <- buildStrategyE strat
evaluateE m (Just strat')
-- ------------------------------------------------------------------ [ Pretty ]
covering
eMain : GLangE ()
eMain = do
as <- getArgs
(mfname, sfname) <- processArgs as
(_ ** ast) <- readLangFile glang mfname
m <- buildModel ast emptyModel
res <- doEvaluateE m sfname
showRes prettyResult res
putStrLn $ toString m
main : IO ()
main = do
run eMain
exit 0
-- --------------------------------------------------------------------- [ EOF ]
|
State Before: ι : Type ?u.116791
α : Type u_1
inst✝¹ : PartialOrder α
inst✝ : LocallyFiniteOrderTop α
a : α
⊢ card (Ioi a) = card (Ici a) - 1 State After: no goals Tactic: rw [Ici_eq_cons_Ioi, card_cons, add_tsub_cancel_right] |
% DATA = MOHSST5_LOADDATA()
% Last modified 2011-01-11
% Copyright (c) Jaakko Luttinen ([email protected])
function data = mohsst5_loaddata()
data = load('mohsst5_data.mat');
|
State Before: X : Type ?u.8941
α : Type u_1
α' : Type ?u.8947
β : Type u_2
γ : Type ?u.8953
δ : Type ?u.8956
M : Type ?u.8959
E : Type ?u.8962
R : Type ?u.8965
inst✝⁴ : TopologicalSpace α
inst✝³ : TopologicalSpace α'
inst✝² : One β
inst✝¹ : One γ
inst✝ : One δ
g : β → γ
f : α → β
f₂ : α → γ
m : β → γ → δ
x : α
⊢ HasCompactMulSupport f ↔ IsCompact (closure (mulSupport f)) State After: no goals Tactic: rfl |
proposition contractible_imp_simply_connected: fixes S :: "_::real_normed_vector set" assumes "contractible S" shows "simply_connected S" |
#ifndef libraries_h
#define libraries_h
#include <fstream>
#include <iostream>
#include <iomanip>
#include <ctime>
#include <math.h>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <array>
#include <algorithm>
#include <unordered_map>
#include <map>
#include <memory>
#include <utility>
#include <string>
#include <gsl/gsl_rng.h>
#include <gsl/gsl_statistics.h>
#include "types.h"
//#include <omp.h>
//#include <tbb/tbb.h>
#endif
|
The main focus of Voyage is puzzle @-@ solving . The player can move by clicking , and can swivel the camera 360 degrees . There are several types of puzzle in Voyage including those involving native plant life on the moon , mechanical puzzles , audio puzzles , and mathematical puzzles . Many of these puzzles require the player to decipher and use the native language of the moon .
|
(*
* Copyright 2014, NICTA
*
* This software may be distributed and modified according to the terms of
* the BSD 2-Clause license. Note that NO WARRANTY is provided.
* See "LICENSE_BSD2.txt" for details.
*
* @TAG(NICTA_BSD)
*)
(* License: BSD, terms see file ./LICENSE *)
(* Definitions supporting the extremely long CTypes.thy *)
theory CTypesDefs
imports
CTypesBase
begin
section "C types setup"
type_synonym field_name = string
type_synonym qualified_field_name = "field_name list"
type_synonym typ_name = string
text {* A typ_desc wraps a typ_struct with a typ name.
A typ_struct is either a Scalar, with size, alignment and either a
field accessor/updator pair (for typ_info) or a 'normalisor'
(for typ_uinfo), or an Aggregate, with a list of typ_desc,
field name pairs.*}
datatype (plugins del: size)
'a typ_desc = TypDesc "'a typ_struct" typ_name
and 'a typ_struct = TypScalar nat nat "'a" |
TypAggregate "('a typ_desc,field_name) dt_pair list"
(* FIXME: eliminate eventually *)
datatype_compat dt_pair
datatype_compat typ_desc typ_struct
(* FIXME: these recreate the precise order of subgoals of the old datatype package *)
lemma typ_desc_induct:
"\<lbrakk>\<And>typ_struct list. P2 typ_struct \<Longrightarrow> P1 (TypDesc typ_struct list); \<And>nat1 nat2 a. P2 (TypScalar nat1 nat2 a);
\<And>list. P3 list \<Longrightarrow> P2 (TypAggregate list); P3 []; \<And>dt_pair list. \<lbrakk>P4 dt_pair; P3 list\<rbrakk> \<Longrightarrow> P3 (dt_pair # list);
\<And>typ_desc list. P1 typ_desc \<Longrightarrow> P4 (DTPair typ_desc list)\<rbrakk>
\<Longrightarrow> P1 typ_desc"
by (rule compat_typ_desc.induct)
lemma typ_struct_induct:
"\<lbrakk>\<And>typ_struct list. P2 typ_struct \<Longrightarrow> P1 (TypDesc typ_struct list); \<And>nat1 nat2 a. P2 (TypScalar nat1 nat2 a);
\<And>list. P3 list \<Longrightarrow> P2 (TypAggregate list); P3 []; \<And>dt_pair list. \<lbrakk>P4 dt_pair; P3 list\<rbrakk> \<Longrightarrow> P3 (dt_pair # list);
\<And>typ_desc list. P1 typ_desc \<Longrightarrow> P4 (DTPair typ_desc list)\<rbrakk>
\<Longrightarrow> P2 typ_struct"
by (rule compat_typ_struct.induct)
lemma typ_list_induct:
"\<lbrakk>\<And>typ_struct list. P2 typ_struct \<Longrightarrow> P1 (TypDesc typ_struct list); \<And>nat1 nat2 a. P2 (TypScalar nat1 nat2 a);
\<And>list. P3 list \<Longrightarrow> P2 (TypAggregate list); P3 []; \<And>dt_pair list. \<lbrakk>P4 dt_pair; P3 list\<rbrakk> \<Longrightarrow> P3 (dt_pair # list);
\<And>typ_desc list. P1 typ_desc \<Longrightarrow> P4 (DTPair typ_desc list)\<rbrakk>
\<Longrightarrow> P3 list"
by (rule compat_typ_desc_char_list_dt_pair_list.induct)
lemma typ_dt_pair_induct:
"\<lbrakk>\<And>typ_struct list. P2 typ_struct \<Longrightarrow> P1 (TypDesc typ_struct list); \<And>nat1 nat2 a. P2 (TypScalar nat1 nat2 a);
\<And>list. P3 list \<Longrightarrow> P2 (TypAggregate list); P3 []; \<And>dt_pair list. \<lbrakk>P4 dt_pair; P3 list\<rbrakk> \<Longrightarrow> P3 (dt_pair # list);
\<And>typ_desc list. P1 typ_desc \<Longrightarrow> P4 (DTPair typ_desc list)\<rbrakk>
\<Longrightarrow> P4 dt_pair"
by (rule compat_typ_desc_char_list_dt_pair.induct)
-- "Declare as default induct rule with old case names"
lemmas typ_desc_typ_struct_inducts [case_names
TypDesc TypScalar TypAggregate Nil_typ_desc Cons_typ_desc DTPair_typ_desc, induct type] =
typ_desc_induct typ_struct_induct typ_list_induct typ_dt_pair_induct
-- "Make sure list induct rule is tried first"
declare list.induct [induct type]
type_synonym 'a typ_pair = "('a typ_desc,field_name) dt_pair"
type_synonym typ_uinfo = "normalisor typ_desc"
type_synonym typ_uinfo_struct = "normalisor typ_struct"
type_synonym typ_uinfo_pair = "normalisor typ_pair"
record 'a field_desc =
field_access :: "'a \<Rightarrow> byte list \<Rightarrow> byte list"
field_update :: "byte list \<Rightarrow> 'a \<Rightarrow> 'a"
type_synonym 'a typ_info = "'a field_desc typ_desc"
type_synonym 'a typ_info_struct = "'a field_desc typ_struct"
type_synonym 'a typ_info_pair = "'a field_desc typ_pair"
definition fu_commutes :: "('b \<Rightarrow> 'a \<Rightarrow> 'a) \<Rightarrow> ('c \<Rightarrow> 'a \<Rightarrow> 'a) \<Rightarrow> bool" where
"fu_commutes f g \<equiv> \<forall>v bs bs'. f bs (g bs' v) = g bs' (f bs v)"
text {* size_td returns the sum of the sizes of all Scalar fields
comprising a typ_desc i.e. the overall size of the type *}
(* Could express this and many other typ_desc primrecs as tree fold/map
combos, but the intuition this way is clearer for anything non-trivial *)
primrec
size_td :: "'a typ_desc \<Rightarrow> nat" and
size_td_struct :: "'a typ_struct \<Rightarrow> nat" and
size_td_list :: "'a typ_pair list \<Rightarrow> nat" and
size_td_pair :: "'a typ_pair \<Rightarrow> nat"
where
tz0: "size_td (TypDesc st nm) = size_td_struct st"
| tz1: "size_td_struct (TypScalar n algn d) = n"
| tz2: "size_td_struct (TypAggregate xs) = size_td_list xs"
| tz3: "size_td_list [] = 0"
| tz4: "size_td_list (x#xs) = size_td_pair x + size_td_list xs"
| tz5: "size_td_pair (DTPair t n) = size_td t"
text {* access_ti overlays the byte-wise representation of an object
on a given byte list, given the typ_info (i.e. the layout) *}
primrec
access_ti :: "'a typ_info \<Rightarrow> ('a \<Rightarrow> byte list \<Rightarrow> byte list)" and
access_ti_struct :: "'a typ_info_struct \<Rightarrow>
('a \<Rightarrow> byte list \<Rightarrow> byte list)" and
access_ti_list :: "'a typ_info_pair list \<Rightarrow>
('a \<Rightarrow> byte list \<Rightarrow> byte list)" and
access_ti_pair :: "'a typ_info_pair \<Rightarrow> ('a \<Rightarrow> byte list \<Rightarrow> byte list)"
where
fa0: "access_ti (TypDesc st nm) = access_ti_struct st"
| fa1: "access_ti_struct (TypScalar n algn d) = field_access d"
| fa2: "access_ti_struct (TypAggregate xs) = access_ti_list xs"
| fa3: "access_ti_list [] = (\<lambda>v bs. [])"
| fa4: "access_ti_list (x#xs) =
(\<lambda>v bs. access_ti_pair x v (take (size_td_pair x) bs) @
access_ti_list xs v (drop (size_td_pair x) bs))"
| fa5: "access_ti_pair (DTPair t nm) = access_ti t"
text \<open>@{text access_ti\<^sub>0} overlays the representation of an object on a
list of zero bytes\<close>
definition access_ti\<^sub>0 :: "'a typ_info \<Rightarrow> ('a \<Rightarrow> byte list)" where
"access_ti\<^sub>0 t \<equiv> \<lambda>v. access_ti t v (replicate (size_td t) 0)"
text {* update_ti updates an object, given a list of bytes (the
representation of the new value), and the typ_info *}
primrec
update_ti :: "'a typ_info \<Rightarrow> (byte list \<Rightarrow> 'a \<Rightarrow> 'a)" and
update_ti_struct :: "'a typ_info_struct \<Rightarrow> (byte list \<Rightarrow> 'a \<Rightarrow> 'a)" and
update_ti_list :: "'a typ_info_pair list \<Rightarrow> (byte list \<Rightarrow> 'a \<Rightarrow> 'a)" and
update_ti_pair :: "'a typ_info_pair \<Rightarrow> (byte list \<Rightarrow> 'a \<Rightarrow> 'a)"
where
fu0: "update_ti (TypDesc st nm) = update_ti_struct st"
| fu1: "update_ti_struct (TypScalar n algn d) = field_update d"
| fu2: "update_ti_struct (TypAggregate xs) = update_ti_list xs"
| fu3: "update_ti_list [] = (\<lambda>bs. id)"
| fu4: "update_ti_list (x#xs) = (\<lambda>bs v.
update_ti_pair x (take (size_td_pair x) bs)
(update_ti_list xs (drop (size_td_pair x) bs) v))"
| fu5: "update_ti_pair (DTPair t nm) = update_ti t"
text {* update_ti_t updates an object only if the length of the
supplied representation equals the object size *}
definition update_ti_t :: "'a typ_info \<Rightarrow> (byte list \<Rightarrow> 'a \<Rightarrow> 'a)" where
"update_ti_t t \<equiv> \<lambda>bs. if length bs = size_td t then
update_ti t bs else id"
definition update_ti_struct_t :: "'a typ_info_struct \<Rightarrow> (byte list \<Rightarrow> 'a \<Rightarrow> 'a)" where
"update_ti_struct_t t \<equiv> \<lambda>bs. if length bs = size_td_struct t then
update_ti_struct t bs else id"
definition update_ti_list_t :: "'a typ_info_pair list \<Rightarrow> (byte list \<Rightarrow> 'a \<Rightarrow> 'a)" where
"update_ti_list_t t \<equiv> \<lambda>bs. if length bs = size_td_list t then
update_ti_list t bs else id"
definition update_ti_pair_t :: "'a typ_info_pair \<Rightarrow> (byte list \<Rightarrow> 'a \<Rightarrow> 'a)" where
"update_ti_pair_t t \<equiv> \<lambda>bs. if length bs = size_td_pair t then
update_ti_pair t bs else id"
text {* field_desc generates the access/update pair for a field,
given the field's type_desc *}
definition field_desc :: "'a typ_info \<Rightarrow> 'a field_desc" where
"field_desc t \<equiv> \<lparr> field_access = access_ti t,
field_update = update_ti_t t \<rparr>"
declare field_desc_def [simp add]
definition field_desc_struct :: "'a typ_info_struct \<Rightarrow> 'a field_desc" where
"field_desc_struct t \<equiv> \<lparr> field_access = access_ti_struct t,
field_update = update_ti_struct_t t \<rparr>"
declare field_desc_struct_def [simp add]
definition field_desc_list :: "'a typ_info_pair list \<Rightarrow> 'a field_desc"
where
"field_desc_list t \<equiv> \<lparr> field_access = access_ti_list t,
field_update = update_ti_list_t t \<rparr>"
declare field_desc_list_def [simp add]
definition field_desc_pair :: "'a typ_info_pair \<Rightarrow> 'a field_desc"
where
"field_desc_pair t \<equiv> \<lparr> field_access = access_ti_pair t,
field_update = update_ti_pair_t t \<rparr>"
declare field_desc_pair_def [simp add]
primrec
map_td :: "(nat \<Rightarrow> nat \<Rightarrow> 'a \<Rightarrow> 'b) \<Rightarrow> 'a typ_desc \<Rightarrow> 'b typ_desc" and
map_td_struct :: "(nat \<Rightarrow> nat \<Rightarrow> 'a \<Rightarrow> 'b) \<Rightarrow> 'a typ_struct \<Rightarrow> 'b typ_struct" and
map_td_list :: "(nat \<Rightarrow> nat \<Rightarrow> 'a \<Rightarrow> 'b) \<Rightarrow> 'a typ_pair list \<Rightarrow>
'b typ_pair list" and
map_td_pair :: "(nat \<Rightarrow> nat \<Rightarrow> 'a \<Rightarrow> 'b) \<Rightarrow> 'a typ_pair \<Rightarrow> 'b typ_pair"
where
mat0: "map_td f (TypDesc st nm) = TypDesc (map_td_struct f st) nm"
| mat1: "map_td_struct f (TypScalar n algn d) = TypScalar n algn (f n algn d)"
| mat2: "map_td_struct f (TypAggregate xs) = TypAggregate (map_td_list f xs)"
| mat3: "map_td_list f [] = []"
| mat4: "map_td_list f (x#xs) = map_td_pair f x # map_td_list f xs"
| mat5: "map_td_pair f (DTPair t n) = DTPair (map_td f t) n"
definition field_norm :: "nat \<Rightarrow> nat \<Rightarrow> 'a field_desc \<Rightarrow> (byte list \<Rightarrow> byte list)"
where
"field_norm \<equiv> \<lambda>n algn d bs.
if length bs = n then
field_access d (field_update d bs undefined) (replicate n 0) else
[]"
definition export_uinfo :: "'a typ_info \<Rightarrow> typ_uinfo" where
"export_uinfo t \<equiv> map_td field_norm t"
primrec
wf_desc :: "'a typ_desc \<Rightarrow> bool" and
wf_desc_struct :: "'a typ_struct \<Rightarrow> bool" and
wf_desc_list :: "'a typ_pair list \<Rightarrow> bool" and
wf_desc_pair :: "'a typ_pair \<Rightarrow> bool"
where
wfd0: "wf_desc (TypDesc ts n) = wf_desc_struct ts"
| wfd1: "wf_desc_struct (TypScalar n algn d) = True"
| wfd2: "wf_desc_struct (TypAggregate ts) = wf_desc_list ts"
| wfd3: "wf_desc_list [] = True"
| wfd4: "wf_desc_list (x#xs) = (wf_desc_pair x \<and> \<not> dt_snd x \<in> dt_snd ` set xs \<and>
wf_desc_list xs)"
| wfd5: "wf_desc_pair (DTPair x n) = wf_desc x"
primrec
wf_size_desc :: "'a typ_desc \<Rightarrow> bool" and
wf_size_desc_struct :: "'a typ_struct \<Rightarrow> bool" and
wf_size_desc_list :: "'a typ_pair list \<Rightarrow> bool" and
wf_size_desc_pair :: "'a typ_pair \<Rightarrow> bool"
where
wfsd0: "wf_size_desc (TypDesc ts n) = wf_size_desc_struct ts"
| wfsd1: "wf_size_desc_struct (TypScalar n algn d) = (0 < n)"
| wfsd2: "wf_size_desc_struct (TypAggregate ts) =
(ts \<noteq> [] \<and> wf_size_desc_list ts)"
| wfsd3: "wf_size_desc_list [] = True"
| wfsd4: "wf_size_desc_list (x#xs) =
(wf_size_desc_pair x \<and> wf_size_desc_list xs)"
| wfsd5: "wf_size_desc_pair (DTPair x n) = wf_size_desc x"
definition
typ_struct :: "'a typ_desc \<Rightarrow> 'a typ_struct"
where
"typ_struct t = (case t of TypDesc st sz \<Rightarrow> st)"
lemma typ_struct [simp]:
"typ_struct (TypDesc st sz) = st"
by (simp add: typ_struct_def)
primrec
typ_name :: "'a typ_desc \<Rightarrow> typ_name"
where
"typ_name (TypDesc st nm) = nm"
primrec
norm_tu :: "typ_uinfo \<Rightarrow> normalisor" and
norm_tu_struct :: "typ_uinfo_struct \<Rightarrow> normalisor" and
norm_tu_list :: "typ_uinfo_pair list \<Rightarrow> normalisor" and
norm_tu_pair :: "typ_uinfo_pair \<Rightarrow> normalisor"
where
tn0: "norm_tu (TypDesc st nm) = norm_tu_struct st"
| tn1: "norm_tu_struct (TypScalar n aln f) = f"
| tn2: "norm_tu_struct (TypAggregate xs) = norm_tu_list xs"
| tn3: "norm_tu_list [] = (\<lambda>bs. [])"
| tn4: "norm_tu_list (x#xs) = (\<lambda>bs.
norm_tu_pair x (take (size_td_pair x) bs) @
norm_tu_list xs (drop (size_td_pair x) bs))"
| tn5: "norm_tu_pair (DTPair t n) = norm_tu t"
class c_type
instance c_type \<subseteq> type ..
consts
typ_info_t :: "'a::c_type itself \<Rightarrow> 'a typ_info"
typ_name_itself :: "'a::c_type itself \<Rightarrow> typ_name"
definition typ_uinfo_t :: "'a::c_type itself \<Rightarrow> typ_uinfo" where
"typ_uinfo_t t \<equiv> export_uinfo (typ_info_t TYPE('a))"
definition to_bytes :: "'a::c_type \<Rightarrow> byte list \<Rightarrow> byte list" where
"to_bytes v \<equiv> access_ti (typ_info_t TYPE('a)) v"
(* from_bytes is now total - all partial C types 'a need to be instantiated
as c_types using 'a option and the parser needs to do some work
extracting the value and generating guards for non-None when these are
used. Luckily for us in our work we never use them. *)
definition from_bytes :: "byte list \<Rightarrow> 'a::c_type" where
"from_bytes bs \<equiv>
field_update (field_desc (typ_info_t TYPE('a))) bs undefined"
type_synonym 'a flr = "('a typ_desc \<times> nat) option"
primrec
field_lookup :: "'a typ_desc \<Rightarrow> qualified_field_name \<Rightarrow> nat \<Rightarrow> 'a flr" and
field_lookup_struct :: "'a typ_struct \<Rightarrow> qualified_field_name \<Rightarrow> nat \<Rightarrow>
'a flr" and
field_lookup_list :: "'a typ_pair list \<Rightarrow> qualified_field_name \<Rightarrow> nat \<Rightarrow>
'a flr" and
field_lookup_pair :: "'a typ_pair \<Rightarrow> qualified_field_name \<Rightarrow> nat \<Rightarrow> 'a flr"
where
fl0: "field_lookup (TypDesc st nm) f m =
(if f=[] then Some (TypDesc st nm,m) else field_lookup_struct st f m)"
| fl1: "field_lookup_struct (TypScalar n algn d) f m = None"
| fl2: "field_lookup_struct (TypAggregate xs) f m = field_lookup_list xs f m"
| fl3: "field_lookup_list [] f m = None"
| fl4: "field_lookup_list (x#xs) f m = (
case field_lookup_pair x f m of
None \<Rightarrow> field_lookup_list xs f (m + size_td (dt_fst x)) |
Some y \<Rightarrow> Some y)"
| fl5: "field_lookup_pair (DTPair t nm) f m =
(if nm=hd f \<and> f \<noteq> [] then field_lookup t (tl f) m else None)"
definition map_td_flr :: "(nat \<Rightarrow> nat \<Rightarrow> 'a \<Rightarrow> 'b) \<Rightarrow>
('a typ_desc \<times> nat) option \<Rightarrow> 'b flr"
where
"map_td_flr f \<equiv> case_option None (\<lambda>(s,n). Some (map_td f s,n))"
definition
import_flr :: "(nat \<Rightarrow> nat \<Rightarrow> 'b \<Rightarrow> 'a) \<Rightarrow> 'a flr \<Rightarrow> ('b typ_desc \<times> nat) option \<Rightarrow> bool"
where
"import_flr f s k \<equiv> case_option (k=None)
(\<lambda>(s,m). case_option False (\<lambda>(t,n). n=m \<and> map_td f t=s) k )
s"
definition
field_offset_untyped :: "'a typ_desc \<Rightarrow> qualified_field_name \<Rightarrow> nat"
where
"field_offset_untyped t n \<equiv> snd (the (field_lookup t n 0))"
definition
field_offset :: "'a::c_type itself \<Rightarrow> qualified_field_name \<Rightarrow> nat"
where
"field_offset t n \<equiv> field_offset_untyped (typ_uinfo_t TYPE('a)) n"
definition
field_ti :: "'a::c_type itself \<Rightarrow> qualified_field_name \<rightharpoonup> 'a typ_info"
where
"field_ti t n \<equiv> case_option None (Some \<circ> fst)
(field_lookup (typ_info_t TYPE('a)) n 0)"
definition
field_size :: "'a::c_type itself \<Rightarrow> qualified_field_name \<Rightarrow> nat"
where
"field_size t n \<equiv> size_td (the (field_ti t n))"
definition
field_lvalue :: "'a::c_type ptr \<Rightarrow> qualified_field_name \<Rightarrow> addr" ("&'(_\<rightarrow>_')")
where
"&(p\<rightarrow>f) \<equiv> ptr_val (p::'a ptr) + of_nat (field_offset TYPE('a) f)"
definition
size_of :: "'a::c_type itself \<Rightarrow> nat" where
"size_of t \<equiv> size_td (typ_info_t TYPE('a))"
definition
norm_bytes :: "'a::c_type itself \<Rightarrow> normalisor" where
"norm_bytes t \<equiv> norm_tu (export_uinfo (typ_info_t t))"
definition to_bytes_p :: "'a::c_type \<Rightarrow> byte list" where
"to_bytes_p v \<equiv> to_bytes v (replicate (size_of TYPE('a)) 0)"
primrec
align_td :: "'a typ_desc \<Rightarrow> nat" and
align_td_struct :: "'a typ_struct \<Rightarrow> nat" and
align_td_list :: "'a typ_pair list \<Rightarrow> nat" and
align_td_pair :: "'a typ_pair \<Rightarrow> nat"
where
al0: "align_td (TypDesc st nm) = align_td_struct st"
| al1: "align_td_struct (TypScalar n algn d) = algn"
| al2: "align_td_struct (TypAggregate xs) = align_td_list xs"
| al3: "align_td_list [] = 0"
| al4: "align_td_list (x#xs) = max (align_td_pair x) (align_td_list xs)"
| al5: "align_td_pair (DTPair t n) = align_td t"
definition align_of :: "'a::c_type itself \<Rightarrow> nat" where
"align_of t \<equiv> 2^(align_td (typ_info_t TYPE('a)))"
definition
ptr_add :: "('a::c_type) ptr \<Rightarrow> int \<Rightarrow> 'a ptr" (infixl "+\<^sub>p" 65)
where
"ptr_add (a :: ('a::c_type) ptr) w \<equiv>
Ptr (ptr_val a + of_int w * of_nat (size_of (TYPE('a))))"
lemma ptr_add_def':
"ptr_add (Ptr p :: ('a::c_type) ptr) n
= (Ptr (p + of_int n * of_nat (size_of TYPE('a))))"
by (cases p, auto simp: ptr_add_def scast_id)
definition
ptr_sub :: "('a::c_type) ptr \<Rightarrow> ('a::c_type) ptr \<Rightarrow> 32 signed word" (infixl "-\<^sub>p" 65)
where
"ptr_sub (a :: ('a::c_type) ptr) p \<equiv>
ucast (ptr_val a - ptr_val p) div of_nat (size_of (TYPE('a)))"
definition ptr_aligned :: "'a::c_type ptr \<Rightarrow> bool" where
"ptr_aligned p \<equiv> align_of TYPE('a) dvd unat (ptr_val (p::'a ptr))"
primrec
td_set :: "'a typ_desc \<Rightarrow> nat \<Rightarrow> ('a typ_desc \<times> nat) set" and
td_set_struct :: "'a typ_struct \<Rightarrow> nat \<Rightarrow> ('a typ_desc \<times> nat) set" and
td_set_list :: "'a typ_pair list \<Rightarrow> nat \<Rightarrow> ('a typ_desc \<times> nat) set" and
td_set_pair :: "'a typ_pair \<Rightarrow> nat \<Rightarrow> ('a typ_desc \<times> nat) set"
where
ts0: "td_set (TypDesc st nm) m = {(TypDesc st nm,m)} \<union> td_set_struct st m"
| ts1: "td_set_struct (TypScalar n algn d) m = {}"
| ts2: "td_set_struct (TypAggregate xs) m = td_set_list xs m"
| ts3: "td_set_list [] m = {}"
| ts4: "td_set_list (x#xs) m = td_set_pair x m \<union> td_set_list xs (m + size_td (dt_fst x))"
| ts5: "td_set_pair (DTPair t nm) m = td_set t m"
instantiation typ_desc :: (type) ord
begin
definition
typ_tag_le_def: "s \<le> (t::'a typ_desc) \<equiv> (\<exists>n. (s,n) \<in> td_set t 0)"
definition
typ_tag_lt_def: "s < (t::'a typ_desc) \<equiv> s \<le> t \<and> s \<noteq> t"
instance ..
end
definition
fd_cons_double_update :: "'a field_desc \<Rightarrow> bool"
where
"fd_cons_double_update d \<equiv>
(\<forall>v bs bs'. length bs = length bs' \<longrightarrow> field_update d bs (field_update d bs' v) = field_update d bs v)"
definition
fd_cons_update_access :: "'a field_desc \<Rightarrow> nat \<Rightarrow> bool"
where
"fd_cons_update_access d n \<equiv>
(\<forall>v bs. length bs = n \<longrightarrow> field_update d (field_access d v bs) v = v)"
definition
norm_desc :: "'a field_desc \<Rightarrow> nat \<Rightarrow> (byte list \<Rightarrow> byte list)"
where
"norm_desc d n \<equiv> \<lambda>bs. field_access d (field_update d bs undefined) (replicate n 0)"
definition
fd_cons_length :: "'a field_desc \<Rightarrow> nat \<Rightarrow> bool"
where
"fd_cons_length d n \<equiv> \<forall>v bs. length bs = n \<longrightarrow> length (field_access d v bs) = n"
definition
fd_cons_access_update :: "'a field_desc \<Rightarrow> nat \<Rightarrow> bool"
where
"fd_cons_access_update d n \<equiv> \<forall>bs bs' v v'. length bs = n \<longrightarrow>
length bs' = n \<longrightarrow>
field_access d (field_update d bs v) bs' = field_access d (field_update d bs v') bs'"
definition
fd_cons_update_normalise :: "'a field_desc \<Rightarrow> nat \<Rightarrow> bool"
where
"fd_cons_update_normalise d n \<equiv>
(\<forall>v bs. length bs=n \<longrightarrow> field_update d (norm_desc d n bs) v = field_update d bs v)"
definition
fd_cons_desc :: "'a field_desc \<Rightarrow> nat \<Rightarrow> bool"
where
"fd_cons_desc d n \<equiv> fd_cons_double_update d \<and>
fd_cons_update_access d n \<and>
fd_cons_access_update d n \<and>
fd_cons_length d n"
definition
fd_cons :: "'a typ_info \<Rightarrow> bool"
where
"fd_cons t \<equiv> fd_cons_desc (field_desc t) (size_td t)"
definition
fd_cons_struct :: "'a typ_info_struct \<Rightarrow> bool"
where
"fd_cons_struct t \<equiv> fd_cons_desc (field_desc_struct t) (size_td_struct t)"
definition
fd_cons_list :: "'a typ_info_pair list \<Rightarrow> bool"
where
"fd_cons_list t \<equiv> fd_cons_desc (field_desc_list t) (size_td_list t)"
definition
fd_cons_pair :: "'a typ_info_pair \<Rightarrow> bool"
where
"fd_cons_pair t \<equiv> fd_cons_desc (field_desc_pair t) (size_td_pair t)"
definition
fa_fu_ind :: "'a field_desc \<Rightarrow> 'a field_desc \<Rightarrow> nat \<Rightarrow> nat \<Rightarrow>bool"
where
"fa_fu_ind d d' n n' \<equiv> \<forall>v bs bs'. length bs = n \<longrightarrow> length bs' = n' \<longrightarrow>
field_access d (field_update d' bs v) bs' = field_access d v bs'"
definition
wf_fdp :: "('a typ_info \<times> qualified_field_name) set \<Rightarrow> bool"
where
"wf_fdp t \<equiv> \<forall>x m. (x,m) \<in> t \<longrightarrow> (fd_cons x \<and> (\<forall>y n. (y,n) \<in> t \<and> \<not> m \<le> n \<and> \<not> n \<le> m
\<longrightarrow> fu_commutes (field_update (field_desc x)) (field_update (field_desc y)) \<and>
fa_fu_ind (field_desc x) (field_desc y) (size_td y) (size_td x)))"
lemma wf_fdp_list:
"wf_fdp (xs \<union> ys) \<Longrightarrow> wf_fdp xs \<and> wf_fdp ys"
by (auto simp: wf_fdp_def)
primrec
wf_fd :: "'a typ_info \<Rightarrow> bool" and
wf_fd_struct :: "'a typ_info_struct \<Rightarrow> bool" and
wf_fd_list :: "'a typ_info_pair list \<Rightarrow> bool" and
wf_fd_pair :: "'a typ_info_pair \<Rightarrow> bool"
where
wffd0: "wf_fd (TypDesc ts n) = (wf_fd_struct ts)"
| wffd1: "wf_fd_struct (TypScalar n algn d) = fd_cons_struct (TypScalar n algn d)"
| wffd2: "wf_fd_struct (TypAggregate ts) = wf_fd_list ts"
| wffd3: "wf_fd_list [] = True"
| wffd4: "wf_fd_list (x#xs) = (wf_fd_pair x \<and> wf_fd_list xs \<and>
fu_commutes (update_ti_pair_t x) (update_ti_list_t xs) \<and>
fa_fu_ind (field_desc_pair x) (field_desc_list xs) (size_td_list xs) (size_td_pair x)\<and>
fa_fu_ind (field_desc_list xs) (field_desc_pair x) (size_td_pair x) (size_td_list xs))"
| wffd5: "wf_fd_pair (DTPair x n) = wf_fd x"
definition
tf_set :: "'a typ_info \<Rightarrow> ('a typ_info \<times> qualified_field_name) set"
where
"tf_set td \<equiv> {(s,f) | s f. \<exists>n. field_lookup td f 0 = Some (s,n)}"
definition
tf_set_struct :: "'a typ_info_struct \<Rightarrow> ('a typ_info \<times> qualified_field_name) set"
where
"tf_set_struct td \<equiv> {(s,f) | s f. \<exists>n. field_lookup_struct td f 0 = Some (s,n)}"
definition
tf_set_list :: "'a typ_info_pair list \<Rightarrow> ('a typ_info \<times> qualified_field_name) set"
where
"tf_set_list td \<equiv> {(s,f) | s f. \<exists>n. field_lookup_list td f 0 = Some (s,n)}"
definition
tf_set_pair :: "'a typ_info_pair \<Rightarrow> ('a typ_info \<times> qualified_field_name) set"
where
"tf_set_pair td \<equiv> {(s,f) | s f. \<exists>n. field_lookup_pair td f 0 = Some (s,n)}"
record 'a leaf_desc =
lf_fd :: "'a field_desc"
lf_sz :: nat
lf_fn :: qualified_field_name
primrec
lf_set :: "'a typ_info \<Rightarrow> qualified_field_name \<Rightarrow> 'a leaf_desc set" and
lf_set_struct :: "'a typ_info_struct \<Rightarrow> qualified_field_name \<Rightarrow> 'a leaf_desc set" and
lf_set_list :: "'a typ_info_pair list \<Rightarrow> qualified_field_name \<Rightarrow> 'a leaf_desc set" and
lf_set_pair :: "'a typ_info_pair \<Rightarrow> qualified_field_name \<Rightarrow> 'a leaf_desc set"
where
fds0: "lf_set (TypDesc st nm) fn = lf_set_struct st fn"
| fds1: "lf_set_struct (TypScalar n algn d) fn = {(\<lparr> lf_fd = d, lf_sz = n, lf_fn = fn \<rparr>)}"
| fds2: "lf_set_struct (TypAggregate xs) fn = lf_set_list xs fn"
| fds3: "lf_set_list [] fn = {}"
| fds4: "lf_set_list (x#xs) fn = lf_set_pair x fn \<union> lf_set_list xs fn"
| fds5: "lf_set_pair (DTPair t n) fn = lf_set t (fn@[n])"
definition
wf_lf :: "'a leaf_desc set \<Rightarrow> bool"
where
"wf_lf D \<equiv> \<forall>x. x \<in> D \<longrightarrow> (fd_cons_desc (lf_fd x) (lf_sz x) \<and> (\<forall>y. y \<in> D \<longrightarrow> lf_fn y \<noteq> lf_fn x
\<longrightarrow> fu_commutes (field_update (lf_fd x)) (field_update (lf_fd y)) \<and>
fa_fu_ind (lf_fd x) (lf_fd y) (lf_sz y) (lf_sz x)))"
definition
ti_ind :: "'a leaf_desc set \<Rightarrow> 'a leaf_desc set \<Rightarrow> bool"
where
"ti_ind X Y \<equiv> \<forall>x y. x \<in> X \<and> y \<in> Y \<longrightarrow> (
fu_commutes (field_update (lf_fd x)) (field_update (lf_fd y)) \<and>
fa_fu_ind (lf_fd x) (lf_fd y) (lf_sz y) (lf_sz x) \<and>
fa_fu_ind (lf_fd y) (lf_fd x) (lf_sz x) (lf_sz y))"
definition
t2d :: "('a typ_info \<times> qualified_field_name) \<Rightarrow> 'a leaf_desc"
where
"t2d x \<equiv> \<lparr> lf_fd = field_desc (fst x), lf_sz = size_td (fst x), lf_fn = snd x\<rparr>"
definition
fd_consistent :: "'a typ_info \<Rightarrow> bool"
where
"fd_consistent t \<equiv> \<forall>f s n. field_lookup t f 0 = Some (s,n)
\<longrightarrow> fd_cons s"
class wf_type = c_type +
assumes wf_desc [simp]: "wf_desc (typ_info_t TYPE('a::c_type))"
assumes wf_size_desc [simp]: "wf_size_desc (typ_info_t TYPE('a::c_type))"
assumes wf_lf [simp]: "wf_lf (lf_set (typ_info_t TYPE('a::c_type)) [])"
definition
super_update_bs :: "byte list \<Rightarrow> byte list \<Rightarrow> nat \<Rightarrow> byte list"
where
"super_update_bs v bs n \<equiv> take n bs @ v @
drop (n + length v) bs"
definition
disj_fn :: "qualified_field_name \<Rightarrow> qualified_field_name \<Rightarrow> bool"
where
"disj_fn s t \<equiv> \<not> s \<le> t \<and> \<not> t \<le> s"
definition
fs_path :: "qualified_field_name list \<Rightarrow> qualified_field_name set"
where
"fs_path xs \<equiv> {x. \<exists>k. k \<in> set xs \<and> x \<le> k} \<union> {x. \<exists>k. k \<in> set xs \<and> k \<le> x}"
definition
field_names :: "'a typ_desc \<Rightarrow> qualified_field_name set"
where
"field_names t \<equiv> {f. field_lookup t f 0 \<noteq> None}"
definition
align_field :: "'a typ_desc \<Rightarrow> bool"
where
"align_field ti \<equiv> \<forall>f s n. field_lookup ti f 0 = Some (s,n) \<longrightarrow>
2^(align_td s) dvd n"
class mem_type_sans_size = wf_type +
assumes upd:
"length bs = size_of TYPE('a) \<longrightarrow>
update_ti_t (typ_info_t TYPE('a::c_type)) bs v
= update_ti_t (typ_info_t TYPE('a)) bs w"
assumes align_size_of: "align_of (TYPE('a::c_type)) dvd size_of TYPE('a)"
assumes align_field: "align_field (typ_info_t TYPE('a::c_type))"
class mem_type = mem_type_sans_size +
assumes max_size: "size_of (TYPE('a::c_type)) < addr_card"
primrec
aggregate :: "'a typ_desc \<Rightarrow> bool" and
aggregate_struct :: "'a typ_struct \<Rightarrow> bool"
where
"aggregate (TypDesc st tn) = aggregate_struct st"
| "aggregate_struct (TypScalar n algn d) = False"
| "aggregate_struct (TypAggregate ts) = True"
class simple_mem_type = mem_type +
assumes simple_tag: "\<not> aggregate (typ_info_t TYPE('a::c_type))"
definition
field_of :: "addr \<Rightarrow> 'a typ_desc \<Rightarrow> 'a typ_desc \<Rightarrow> bool"
where
"field_of q s t \<equiv> (s,unat q) \<in> td_set t 0"
definition
field_of_t :: "'a::c_type ptr \<Rightarrow> 'b::c_type ptr \<Rightarrow> bool"
where
"field_of_t p q \<equiv> field_of (ptr_val p - ptr_val q) (typ_uinfo_t TYPE('a))
(typ_uinfo_t TYPE('b))"
definition
h_val :: "heap_mem \<Rightarrow> 'a::c_type ptr \<Rightarrow> 'a"
where
"h_val h \<equiv> \<lambda>p. from_bytes (heap_list h (size_of TYPE ('a))
(ptr_val (p::'a ptr)))"
primrec
heap_update_list :: "addr \<Rightarrow> byte list \<Rightarrow> heap_mem \<Rightarrow> heap_mem"
where
heap_update_list_base: "heap_update_list p [] h = h"
| heap_update_list_rec:
"heap_update_list p (x#xs) h = heap_update_list (p + 1) xs (h(p:= x))"
type_synonym 'a typ_heap_g = "'a ptr \<Rightarrow> 'a"
(* FIXME: now redundant with h_val *)
definition
lift :: "heap_mem \<Rightarrow> 'a::c_type typ_heap_g"
where
"lift h \<equiv> h_val h"
definition
heap_update :: "'a::c_type ptr \<Rightarrow> 'a \<Rightarrow> heap_mem \<Rightarrow> heap_mem"
where
"heap_update p v h \<equiv> heap_update_list (ptr_val p) (to_bytes v (heap_list h (size_of TYPE('a)) (ptr_val p))) h"
fun
fold_td' :: "(typ_name \<Rightarrow> ('a \<times> field_name) list \<Rightarrow> 'a) \<times> 'a typ_desc \<Rightarrow> 'a"
where
fot0: "fold_td' (f,TypDesc st nm) = (case st of
TypScalar n algn d \<Rightarrow> d |
TypAggregate ts \<Rightarrow> f nm (map (\<lambda>x. case x of DTPair t n \<Rightarrow> (fold_td' (f,t),n)) ts))"
definition
fold_td :: "(typ_name \<Rightarrow> ('a \<times> field_name) list \<Rightarrow> 'a) \<Rightarrow> 'a typ_desc \<Rightarrow> 'a"
where
"fold_td \<equiv> \<lambda>f t. fold_td' (f,t)"
declare fold_td_def [simp]
definition
fold_td_struct :: "typ_name \<Rightarrow> (typ_name \<Rightarrow> ('a \<times> field_name) list \<Rightarrow> 'a) \<Rightarrow> 'a typ_struct \<Rightarrow> 'a"
where
"fold_td_struct tn f st \<equiv> (case st of
TypScalar n algn d \<Rightarrow> d |
TypAggregate ts \<Rightarrow> f tn (map (\<lambda>x. case x of DTPair t n \<Rightarrow> (fold_td' (f,t),n)) ts))"
declare fold_td_struct_def [simp]
definition
fold_td_list :: "typ_name \<Rightarrow> (typ_name \<Rightarrow> ('a \<times> field_name) list \<Rightarrow> 'a) \<Rightarrow> 'a typ_pair list \<Rightarrow> 'a"
where
"fold_td_list tn f ts \<equiv> f tn (map (\<lambda>x. case x of DTPair t n \<Rightarrow> (fold_td' (f,t),n)) ts)"
declare fold_td_list_def [simp]
definition
fold_td_pair :: "(typ_name \<Rightarrow> ('a \<times> field_name) list \<Rightarrow> 'a) \<Rightarrow> 'a typ_pair \<Rightarrow> 'a"
where
"fold_td_pair f x \<equiv> (case x of DTPair t n \<Rightarrow> fold_td' (f,t))"
declare fold_td_pair_def [simp]
fun
map_td' :: "(nat \<Rightarrow> nat \<Rightarrow> 'a \<Rightarrow> 'b) \<times> 'a typ_desc \<Rightarrow> 'b typ_desc"
where
"map_td' (f,TypDesc st nm) = (TypDesc (case st of
TypScalar n algn d \<Rightarrow> TypScalar n algn (f n algn d) |
TypAggregate ts \<Rightarrow> TypAggregate (map (\<lambda>x. case x of DTPair t n \<Rightarrow> DTPair (map_td' (f,t)) n) ts)) nm)"
definition
tnSum :: "typ_name \<Rightarrow> (nat \<times> field_name) list \<Rightarrow> nat"
where
"tnSum \<equiv> \<lambda>tn ts. foldr (op + o fst) ts 0"
definition
tnMax :: "typ_name \<Rightarrow> (nat \<times> field_name) list \<Rightarrow> nat"
where
"tnMax \<equiv> \<lambda>tn ts. foldr (\<lambda>x y. max (fst x) y) ts 0"
definition
wfd :: "typ_name \<Rightarrow> (bool \<times> field_name) list \<Rightarrow> bool"
where
"wfd \<equiv> \<lambda>tn ts. distinct (map snd ts) \<and> foldr (op \<and>) (map fst ts) True"
definition
wfsd :: "typ_name \<Rightarrow> (bool \<times> field_name) list \<Rightarrow> bool"
where
"wfsd \<equiv> \<lambda>tn ts. ts \<noteq> [] \<and> foldr (op \<and>) (map fst ts) True"
end
|
section \<open>\<open>Extra_Ordered_Fields\<close> -- Additional facts about ordered fields\<close>
theory Extra_Ordered_Fields
imports Complex_Main "HOL-Library.Complex_Order"
begin
subsection\<open>Ordered Fields\<close>
text \<open>In this section we introduce some type classes for ordered rings/fields/etc.
that are weakenings of existing classes. Most theorems in this section are
copies of the eponymous theorems from Isabelle/HOL, except that they are now proven
requiring weaker type classes (usually the need for a total order is removed).
Since the lemmas are identical to the originals except for weaker type constraints,
we use the same names as for the original lemmas. (In fact, the new lemmas could replace
the original ones in Isabelle/HOL with at most minor incompatibilities.\<close>
subsection \<open>Missing from Orderings.thy\<close>
text \<open>This class is analogous to \<^class>\<open>unbounded_dense_linorder\<close>, except that it does not require a total order\<close>
class unbounded_dense_order = dense_order + no_top + no_bot
instance unbounded_dense_linorder \<subseteq> unbounded_dense_order ..
subsection \<open>Missing from Rings.thy\<close>
text \<open>The existing class \<^class>\<open>abs_if\<close> requires \<^term>\<open>\<bar>a\<bar> = (if a < 0 then - a else a)\<close>.
However, if \<^term>\<open>(<)\<close> is not a total order, this condition is too strong when \<^term>\<open>a\<close>
is incomparable with \<^term>\<open>0\<close>. (Namely, it requires the absolute value to be
the identity on such elements. E.g., the absolute value for complex numbers does not
satisfy this.) The following class \<open>partial_abs_if\<close> is analogous to \<^class>\<open>abs_if\<close>
but does not require anything if \<^term>\<open>a\<close> is incomparable with \<^term>\<open>0\<close>.\<close>
class partial_abs_if = minus + uminus + ord + zero + abs +
assumes abs_neg: "a \<le> 0 \<Longrightarrow> abs a = -a"
assumes abs_pos: "a \<ge> 0 \<Longrightarrow> abs a = a"
class ordered_semiring_1 = ordered_semiring + semiring_1
\<comment> \<open>missing class analogous to \<^class>\<open>linordered_semiring_1\<close> without requiring a total order\<close>
begin
lemma convex_bound_le:
assumes "x \<le> a" and "y \<le> a" and "0 \<le> u" and "0 \<le> v" and "u + v = 1"
shows "u * x + v * y \<le> a"
proof-
from assms have "u * x + v * y \<le> u * a + v * a"
by (simp add: add_mono mult_left_mono)
with assms show ?thesis
unfolding distrib_right[symmetric] by simp
qed
end
subclass (in linordered_semiring_1) ordered_semiring_1 ..
class ordered_semiring_strict = semiring + comm_monoid_add + ordered_cancel_ab_semigroup_add +
\<comment> \<open>missing class analogous to \<^class>\<open>linordered_semiring_strict\<close> without requiring a total order\<close>
assumes mult_strict_left_mono: "a < b \<Longrightarrow> 0 < c \<Longrightarrow> c * a < c * b"
assumes mult_strict_right_mono: "a < b \<Longrightarrow> 0 < c \<Longrightarrow> a * c < b * c"
begin
subclass semiring_0_cancel ..
subclass ordered_semiring
proof
fix a b c :: 'a
assume t1: "a \<le> b" and t2: "0 \<le> c"
thus "c * a \<le> c * b"
unfolding le_less
using mult_strict_left_mono by (cases "c = 0") auto
from t2 show "a * c \<le> b * c"
unfolding le_less
by (metis local.antisym_conv2 local.mult_not_zero local.mult_strict_right_mono t1)
qed
lemma mult_pos_pos[simp]: "0 < a \<Longrightarrow> 0 < b \<Longrightarrow> 0 < a * b"
using mult_strict_left_mono [of 0 b a] by simp
lemma mult_pos_neg: "0 < a \<Longrightarrow> b < 0 \<Longrightarrow> a * b < 0"
using mult_strict_left_mono [of b 0 a] by simp
lemma mult_neg_pos: "a < 0 \<Longrightarrow> 0 < b \<Longrightarrow> a * b < 0"
using mult_strict_right_mono [of a 0 b] by simp
text \<open>Strict monotonicity in both arguments\<close>
lemma mult_strict_mono:
assumes t1: "a < b" and t2: "c < d" and t3: "0 < b" and t4: "0 \<le> c"
shows "a * c < b * d"
proof-
have "a * c < b * d"
by (metis local.dual_order.order_iff_strict local.dual_order.strict_trans2
local.mult_strict_left_mono local.mult_strict_right_mono local.mult_zero_right t1 t2 t3 t4)
thus ?thesis
using assms by blast
qed
text \<open>This weaker variant has more natural premises\<close>
lemma mult_strict_mono':
assumes "a < b" and "c < d" and "0 \<le> a" and "0 \<le> c"
shows "a * c < b * d"
by (rule mult_strict_mono) (insert assms, auto)
lemma mult_less_le_imp_less:
assumes t1: "a < b" and t2: "c \<le> d" and t3: "0 \<le> a" and t4: "0 < c"
shows "a * c < b * d"
using local.mult_strict_mono' local.mult_strict_right_mono local.order.order_iff_strict
t1 t2 t3 t4 by auto
lemma mult_le_less_imp_less:
assumes "a \<le> b" and "c < d" and "0 < a" and "0 \<le> c"
shows "a * c < b * d"
by (metis assms(1) assms(2) assms(3) assms(4) local.antisym_conv2 local.dual_order.strict_trans1
local.mult_strict_left_mono local.mult_strict_mono)
end
subclass (in linordered_semiring_strict) ordered_semiring_strict
apply standard
by (auto simp: mult_strict_left_mono mult_strict_right_mono)
class ordered_semiring_1_strict = ordered_semiring_strict + semiring_1
\<comment> \<open>missing class analogous to \<^class>\<open>linordered_semiring_1_strict\<close> without requiring
a total order\<close>
begin
subclass ordered_semiring_1 ..
lemma convex_bound_lt:
assumes "x < a" and "y < a" and "0 \<le> u" and "0 \<le> v" and "u + v = 1"
shows "u * x + v * y < a"
proof -
from assms have "u * x + v * y < u * a + v * a"
by (cases "u = 0") (auto intro!: add_less_le_mono mult_strict_left_mono mult_left_mono)
with assms show ?thesis
unfolding distrib_right[symmetric] by simp
qed
end
subclass (in linordered_semiring_1_strict) ordered_semiring_1_strict ..
class ordered_comm_semiring_strict = comm_semiring_0 + ordered_cancel_ab_semigroup_add +
\<comment> \<open>missing class analogous to \<^class>\<open>linordered_comm_semiring_strict\<close> without requiring a total order\<close>
assumes comm_mult_strict_left_mono: "a < b \<Longrightarrow> 0 < c \<Longrightarrow> c * a < c * b"
begin
subclass ordered_semiring_strict
proof
fix a b c :: 'a
assume "a < b" and "0 < c"
thus "c * a < c * b"
by (rule comm_mult_strict_left_mono)
thus "a * c < b * c"
by (simp only: mult.commute)
qed
subclass ordered_cancel_comm_semiring
proof
fix a b c :: 'a
assume "a \<le> b" and "0 \<le> c"
thus "c * a \<le> c * b"
unfolding le_less
using mult_strict_left_mono by (cases "c = 0") auto
qed
end
subclass (in linordered_comm_semiring_strict) ordered_comm_semiring_strict
apply standard
by (simp add: local.mult_strict_left_mono)
class ordered_ring_strict = ring + ordered_semiring_strict
+ ordered_ab_group_add + partial_abs_if
\<comment> \<open>missing class analogous to \<^class>\<open>linordered_ring_strict\<close> without requiring a total order\<close>
begin
subclass ordered_ring ..
lemma mult_strict_left_mono_neg: "b < a \<Longrightarrow> c < 0 \<Longrightarrow> c * a < c * b"
using mult_strict_left_mono [of b a "- c"] by simp
lemma mult_strict_right_mono_neg: "b < a \<Longrightarrow> c < 0 \<Longrightarrow> a * c < b * c"
using mult_strict_right_mono [of b a "- c"] by simp
lemma mult_neg_neg: "a < 0 \<Longrightarrow> b < 0 \<Longrightarrow> 0 < a * b"
using mult_strict_right_mono_neg [of a 0 b] by simp
end
lemmas mult_sign_intros =
mult_nonneg_nonneg mult_nonneg_nonpos
mult_nonpos_nonneg mult_nonpos_nonpos
mult_pos_pos mult_pos_neg
mult_neg_pos mult_neg_neg
subsection \<open>Ordered fields\<close>
class ordered_field = field + order + ordered_comm_semiring_strict + ordered_ab_group_add
+ partial_abs_if
\<comment> \<open>missing class analogous to \<^class>\<open>linordered_field\<close> without requiring a total order\<close>
begin
lemma frac_less_eq:
"y \<noteq> 0 \<Longrightarrow> z \<noteq> 0 \<Longrightarrow> x / y < w / z \<longleftrightarrow> (x * z - w * y) / (y * z) < 0"
by (subst less_iff_diff_less_0) (simp add: diff_frac_eq )
lemma frac_le_eq:
"y \<noteq> 0 \<Longrightarrow> z \<noteq> 0 \<Longrightarrow> x / y \<le> w / z \<longleftrightarrow> (x * z - w * y) / (y * z) \<le> 0"
by (subst le_iff_diff_le_0) (simp add: diff_frac_eq )
lemmas sign_simps = algebra_simps zero_less_mult_iff mult_less_0_iff
lemmas (in -) sign_simps = algebra_simps zero_less_mult_iff mult_less_0_iff
text\<open>Simplify expressions equated with 1\<close>
lemma zero_eq_1_divide_iff [simp]: "0 = 1 / a \<longleftrightarrow> a = 0"
by (cases "a = 0") (auto simp: field_simps)
lemma one_divide_eq_0_iff [simp]: "1 / a = 0 \<longleftrightarrow> a = 0"
using zero_eq_1_divide_iff[of a] by simp
text\<open>Simplify expressions such as \<open>0 < 1/x\<close> to \<open>0 < x\<close>\<close>
text\<open>Simplify quotients that are compared with the value 1.\<close>
text \<open>Conditional Simplification Rules: No Case Splits\<close>
lemma eq_divide_eq_1 [simp]:
"(1 = b/a) = ((a \<noteq> 0 & a = b))"
by (auto simp add: eq_divide_eq)
lemma divide_eq_eq_1 [simp]:
"(b/a = 1) = ((a \<noteq> 0 & a = b))"
by (auto simp add: divide_eq_eq)
end (* class ordered_field *)
text \<open>The following type class intends to capture some important properties
that are common both to the real and the complex numbers. The purpose is
to be able to state and prove lemmas that apply both to the real and the complex
numbers without needing to state the lemma twice.
\<close>
class nice_ordered_field = ordered_field + zero_less_one + idom_abs_sgn +
assumes positive_imp_inverse_positive: "0 < a \<Longrightarrow> 0 < inverse a"
and inverse_le_imp_le: "inverse a \<le> inverse b \<Longrightarrow> 0 < a \<Longrightarrow> b \<le> a"
and dense_le: "(\<And>x. x < y \<Longrightarrow> x \<le> z) \<Longrightarrow> y \<le> z"
and nn_comparable: "0 \<le> a \<Longrightarrow> 0 \<le> b \<Longrightarrow> a \<le> b \<or> b \<le> a"
and abs_nn: "\<bar>x\<bar> \<ge> 0"
begin
subclass (in linordered_field) nice_ordered_field
proof
show "\<bar>a\<bar> = - a"
if "a \<le> 0"
for a :: 'a
using that
by simp
show "\<bar>a\<bar> = a"
if "0 \<le> a"
for a :: 'a
using that
by simp
show "0 < inverse a"
if "0 < a"
for a :: 'a
using that
by simp
show "b \<le> a"
if "inverse a \<le> inverse b"
and "0 < a"
for a :: 'a
and b
using that
using local.inverse_le_imp_le by blast
show "y \<le> z"
if "\<And>x::'a. x < y \<Longrightarrow> x \<le> z"
for y
and z
using that
using local.dense_le by blast
show "a \<le> b \<or> b \<le> a"
if "0 \<le> a"
and "0 \<le> b"
for a :: 'a
and b
using that
by auto
show "0 \<le> \<bar>x\<bar>"
for x :: 'a
by simp
qed
lemma comparable:
assumes h1: "a \<le> c \<or> a \<ge> c"
and h2: "b \<le> c \<or> b \<ge> c"
shows "a \<le> b \<or> b \<le> a"
proof-
have "a \<le> b"
if t1: "\<not> b \<le> a" and t2: "a \<le> c" and t3: "b \<le> c"
proof-
have "0 \<le> c-a"
by (simp add: t2)
moreover have "0 \<le> c-b"
by (simp add: t3)
ultimately have "c-a \<le> c-b \<or> c-a \<ge> c-b" by (rule nn_comparable)
hence "-a \<le> -b \<or> -a \<ge> -b"
using local.add_le_imp_le_right local.uminus_add_conv_diff by presburger
thus ?thesis
by (simp add: t1)
qed
moreover have "a \<le> b"
if t1: "\<not> b \<le> a" and t2: "c \<le> a" and t3: "b \<le> c"
proof-
have "b \<le> a"
using local.dual_order.trans t2 t3 by blast
thus ?thesis
using t1 by auto
qed
moreover have "a \<le> b"
if t1: "\<not> b \<le> a" and t2: "c \<le> a" and t3: "c \<le> b"
proof-
have "0 \<le> a-c"
by (simp add: t2)
moreover have "0 \<le> b-c"
by (simp add: t3)
ultimately have "a-c \<le> b-c \<or> a-c \<ge> b-c" by (rule nn_comparable)
hence "a \<le> b \<or> a \<ge> b"
by (simp add: local.le_diff_eq)
thus ?thesis
by (simp add: t1)
qed
ultimately show ?thesis using assms by auto
qed
lemma negative_imp_inverse_negative:
"a < 0 \<Longrightarrow> inverse a < 0"
by (insert positive_imp_inverse_positive [of "-a"],
simp add: nonzero_inverse_minus_eq less_imp_not_eq)
lemma inverse_positive_imp_positive:
assumes inv_gt_0: "0 < inverse a" and nz: "a \<noteq> 0"
shows "0 < a"
proof -
have "0 < inverse (inverse a)"
using inv_gt_0 by (rule positive_imp_inverse_positive)
thus "0 < a"
using nz by (simp add: nonzero_inverse_inverse_eq)
qed
lemma inverse_negative_imp_negative:
assumes inv_less_0: "inverse a < 0" and nz: "a \<noteq> 0"
shows "a < 0"
proof-
have "inverse (inverse a) < 0"
using inv_less_0 by (rule negative_imp_inverse_negative)
thus "a < 0" using nz by (simp add: nonzero_inverse_inverse_eq)
qed
lemma linordered_field_no_lb:
"\<forall>x. \<exists>y. y < x"
proof
fix x::'a
have m1: "- (1::'a) < 0" by simp
from add_strict_right_mono[OF m1, where c=x]
have "(- 1) + x < x" by simp
thus "\<exists>y. y < x" by blast
qed
lemma linordered_field_no_ub:
"\<forall>x. \<exists>y. y > x"
proof
fix x::'a
have m1: " (1::'a) > 0" by simp
from add_strict_right_mono[OF m1, where c=x]
have "1 + x > x" by simp
thus "\<exists>y. y > x" by blast
qed
lemma less_imp_inverse_less:
assumes less: "a < b" and apos: "0 < a"
shows "inverse b < inverse a"
using assms by (metis local.dual_order.strict_iff_order
local.inverse_inverse_eq local.inverse_le_imp_le local.positive_imp_inverse_positive)
lemma inverse_less_imp_less:
"inverse a < inverse b \<Longrightarrow> 0 < a \<Longrightarrow> b < a"
using local.inverse_le_imp_le local.order.strict_iff_order by blast
text\<open>Both premises are essential. Consider -1 and 1.\<close>
lemma inverse_less_iff_less [simp]:
"0 < a \<Longrightarrow> 0 < b \<Longrightarrow> inverse a < inverse b \<longleftrightarrow> b < a"
by (blast intro: less_imp_inverse_less dest: inverse_less_imp_less)
lemma le_imp_inverse_le:
"a \<le> b \<Longrightarrow> 0 < a \<Longrightarrow> inverse b \<le> inverse a"
by (force simp add: le_less less_imp_inverse_less)
lemma inverse_le_iff_le [simp]:
"0 < a \<Longrightarrow> 0 < b \<Longrightarrow> inverse a \<le> inverse b \<longleftrightarrow> b \<le> a"
by (blast intro: le_imp_inverse_le dest: inverse_le_imp_le)
text\<open>These results refer to both operands being negative. The opposite-sign
case is trivial, since inverse preserves signs.\<close>
lemma inverse_le_imp_le_neg:
"inverse a \<le> inverse b \<Longrightarrow> b < 0 \<Longrightarrow> b \<le> a"
by (metis local.inverse_le_imp_le local.inverse_minus_eq local.neg_0_less_iff_less
local.neg_le_iff_le)
lemma inverse_less_imp_less_neg:
"inverse a < inverse b \<Longrightarrow> b < 0 \<Longrightarrow> b < a"
using local.dual_order.strict_iff_order local.inverse_le_imp_le_neg by blast
lemma inverse_less_iff_less_neg [simp]:
"a < 0 \<Longrightarrow> b < 0 \<Longrightarrow> inverse a < inverse b \<longleftrightarrow> b < a"
by (metis local.antisym_conv2 local.inverse_less_imp_less_neg local.negative_imp_inverse_negative
local.nonzero_inverse_inverse_eq local.order.strict_implies_order)
lemma le_imp_inverse_le_neg:
"a \<le> b \<Longrightarrow> b < 0 \<Longrightarrow> inverse b \<le> inverse a"
by (force simp add: le_less less_imp_inverse_less_neg)
lemma inverse_le_iff_le_neg [simp]:
"a < 0 \<Longrightarrow> b < 0 \<Longrightarrow> inverse a \<le> inverse b \<longleftrightarrow> b \<le> a"
by (blast intro: le_imp_inverse_le_neg dest: inverse_le_imp_le_neg)
lemma one_less_inverse:
"0 < a \<Longrightarrow> a < 1 \<Longrightarrow> 1 < inverse a"
using less_imp_inverse_less [of a 1, unfolded inverse_1] .
lemma one_le_inverse:
"0 < a \<Longrightarrow> a \<le> 1 \<Longrightarrow> 1 \<le> inverse a"
using le_imp_inverse_le [of a 1, unfolded inverse_1] .
lemma pos_le_divide_eq [field_simps]:
assumes "0 < c"
shows "a \<le> b / c \<longleftrightarrow> a * c \<le> b"
using assms by (metis local.divide_eq_imp local.divide_inverse_commute
local.dual_order.order_iff_strict local.dual_order.strict_iff_order
local.mult_right_mono local.mult_strict_left_mono local.nonzero_divide_eq_eq
local.order.strict_implies_order local.positive_imp_inverse_positive)
lemma pos_less_divide_eq [field_simps]:
assumes "0 < c"
shows "a < b / c \<longleftrightarrow> a * c < b"
using assms local.dual_order.strict_iff_order local.nonzero_divide_eq_eq local.pos_le_divide_eq
by auto
lemma neg_less_divide_eq [field_simps]:
assumes "c < 0"
shows "a < b / c \<longleftrightarrow> b < a * c"
by (metis assms local.minus_divide_divide local.mult_minus_right local.neg_0_less_iff_less
local.neg_less_iff_less local.pos_less_divide_eq)
lemma neg_le_divide_eq [field_simps]:
assumes "c < 0"
shows "a \<le> b / c \<longleftrightarrow> b \<le> a * c"
by (metis assms local.dual_order.order_iff_strict local.dual_order.strict_iff_order
local.neg_less_divide_eq local.nonzero_divide_eq_eq)
lemma pos_divide_le_eq [field_simps]:
assumes "0 < c"
shows "b / c \<le> a \<longleftrightarrow> b \<le> a * c"
by (metis assms local.dual_order.strict_iff_order local.nonzero_eq_divide_eq
local.pos_le_divide_eq)
lemma pos_divide_less_eq [field_simps]:
assumes "0 < c"
shows "b / c < a \<longleftrightarrow> b < a * c"
by (metis assms local.minus_divide_left local.mult_minus_left local.neg_less_iff_less
local.pos_less_divide_eq)
lemma neg_divide_le_eq [field_simps]:
assumes "c < 0"
shows "b / c \<le> a \<longleftrightarrow> a * c \<le> b"
by (metis assms local.minus_divide_left local.mult_minus_left local.neg_le_divide_eq
local.neg_le_iff_le)
lemma neg_divide_less_eq [field_simps]:
assumes "c < 0"
shows "b / c < a \<longleftrightarrow> a * c < b"
using assms local.dual_order.strict_iff_order local.neg_divide_le_eq by auto
text\<open>The following \<open>field_simps\<close> rules are necessary, as minus is always moved atop of
division but we want to get rid of division.\<close>
lemma pos_le_minus_divide_eq [field_simps]: "0 < c \<Longrightarrow> a \<le> - (b / c) \<longleftrightarrow> a * c \<le> - b"
unfolding minus_divide_left by (rule pos_le_divide_eq)
lemma neg_le_minus_divide_eq [field_simps]: "c < 0 \<Longrightarrow> a \<le> - (b / c) \<longleftrightarrow> - b \<le> a * c"
unfolding minus_divide_left by (rule neg_le_divide_eq)
lemma pos_less_minus_divide_eq [field_simps]: "0 < c \<Longrightarrow> a < - (b / c) \<longleftrightarrow> a * c < - b"
unfolding minus_divide_left by (rule pos_less_divide_eq)
lemma neg_less_minus_divide_eq [field_simps]: "c < 0 \<Longrightarrow> a < - (b / c) \<longleftrightarrow> - b < a * c"
unfolding minus_divide_left by (rule neg_less_divide_eq)
lemma pos_minus_divide_less_eq [field_simps]: "0 < c \<Longrightarrow> - (b / c) < a \<longleftrightarrow> - b < a * c"
unfolding minus_divide_left by (rule pos_divide_less_eq)
lemma neg_minus_divide_less_eq [field_simps]: "c < 0 \<Longrightarrow> - (b / c) < a \<longleftrightarrow> a * c < - b"
unfolding minus_divide_left by (rule neg_divide_less_eq)
lemma pos_minus_divide_le_eq [field_simps]: "0 < c \<Longrightarrow> - (b / c) \<le> a \<longleftrightarrow> - b \<le> a * c"
unfolding minus_divide_left by (rule pos_divide_le_eq)
lemma neg_minus_divide_le_eq [field_simps]: "c < 0 \<Longrightarrow> - (b / c) \<le> a \<longleftrightarrow> a * c \<le> - b"
unfolding minus_divide_left by (rule neg_divide_le_eq)
lemma frac_less_eq:
"y \<noteq> 0 \<Longrightarrow> z \<noteq> 0 \<Longrightarrow> x / y < w / z \<longleftrightarrow> (x * z - w * y) / (y * z) < 0"
by (subst less_iff_diff_less_0) (simp add: diff_frac_eq )
lemma frac_le_eq:
"y \<noteq> 0 \<Longrightarrow> z \<noteq> 0 \<Longrightarrow> x / y \<le> w / z \<longleftrightarrow> (x * z - w * y) / (y * z) \<le> 0"
by (subst le_iff_diff_le_0) (simp add: diff_frac_eq )
text\<open>Lemmas \<open>sign_simps\<close> is a first attempt to automate proofs
of positivity/negativity needed for \<open>field_simps\<close>. Have not added \<open>sign_simps\<close> to \<open>field_simps\<close>
because the former can lead to case explosions.\<close>
lemma divide_pos_pos[simp]:
"0 < x \<Longrightarrow> 0 < y \<Longrightarrow> 0 < x / y"
by(simp add:field_simps)
lemma divide_nonneg_pos:
"0 \<le> x \<Longrightarrow> 0 < y \<Longrightarrow> 0 \<le> x / y"
by(simp add:field_simps)
lemma divide_neg_pos:
"x < 0 \<Longrightarrow> 0 < y \<Longrightarrow> x / y < 0"
by(simp add:field_simps)
lemma divide_nonpos_pos:
"x \<le> 0 \<Longrightarrow> 0 < y \<Longrightarrow> x / y \<le> 0"
by(simp add:field_simps)
lemma divide_pos_neg:
"0 < x \<Longrightarrow> y < 0 \<Longrightarrow> x / y < 0"
by(simp add:field_simps)
lemma divide_nonneg_neg:
"0 \<le> x \<Longrightarrow> y < 0 \<Longrightarrow> x / y \<le> 0"
by(simp add:field_simps)
lemma divide_neg_neg:
"x < 0 \<Longrightarrow> y < 0 \<Longrightarrow> 0 < x / y"
by(simp add:field_simps)
lemma divide_nonpos_neg:
"x \<le> 0 \<Longrightarrow> y < 0 \<Longrightarrow> 0 \<le> x / y"
by(simp add:field_simps)
lemma divide_strict_right_mono:
"a < b \<Longrightarrow> 0 < c \<Longrightarrow> a / c < b / c"
by (simp add: less_imp_not_eq2 divide_inverse mult_strict_right_mono
positive_imp_inverse_positive)
lemma divide_strict_right_mono_neg:
"b < a \<Longrightarrow> c < 0 \<Longrightarrow> a / c < b / c"
by (simp add: local.neg_less_divide_eq)
text\<open>The last premise ensures that \<^term>\<open>a\<close> and \<^term>\<open>b\<close>
have the same sign\<close>
lemma divide_strict_left_mono:
"b < a \<Longrightarrow> 0 < c \<Longrightarrow> 0 < a*b \<Longrightarrow> c / a < c / b"
by (metis local.divide_neg_pos local.dual_order.strict_iff_order local.frac_less_eq local.less_iff_diff_less_0 local.mult_not_zero local.mult_strict_left_mono)
lemma divide_left_mono:
"b \<le> a \<Longrightarrow> 0 \<le> c \<Longrightarrow> 0 < a*b \<Longrightarrow> c / a \<le> c / b"
using local.divide_cancel_left local.divide_strict_left_mono local.dual_order.order_iff_strict by auto
lemma divide_strict_left_mono_neg:
"a < b \<Longrightarrow> c < 0 \<Longrightarrow> 0 < a*b \<Longrightarrow> c / a < c / b"
by (metis local.divide_strict_left_mono local.minus_divide_left local.neg_0_less_iff_less local.neg_less_iff_less mult_commute)
lemma mult_imp_div_pos_le: "0 < y \<Longrightarrow> x \<le> z * y \<Longrightarrow> x / y \<le> z"
by (subst pos_divide_le_eq, assumption+)
lemma mult_imp_le_div_pos: "0 < y \<Longrightarrow> z * y \<le> x \<Longrightarrow> z \<le> x / y"
by(simp add:field_simps)
lemma mult_imp_div_pos_less: "0 < y \<Longrightarrow> x < z * y \<Longrightarrow> x / y < z"
by(simp add:field_simps)
lemma mult_imp_less_div_pos: "0 < y \<Longrightarrow> z * y < x \<Longrightarrow> z < x / y"
by(simp add:field_simps)
lemma frac_le: "0 \<le> x \<Longrightarrow> x \<le> y \<Longrightarrow> 0 < w \<Longrightarrow> w \<le> z \<Longrightarrow> x / z \<le> y / w"
using local.mult_imp_div_pos_le local.mult_imp_le_div_pos local.mult_mono by auto
lemma frac_less: "0 \<le> x \<Longrightarrow> x < y \<Longrightarrow> 0 < w \<Longrightarrow> w \<le> z \<Longrightarrow> x / z < y / w"
proof-
assume a1: "w \<le> z"
assume a2: "0 < w"
assume a3: "0 \<le> x"
assume a4: "x < y"
have f5: "a = 0 \<or> (b = c / a) = (b * a = c)"
for a b c::'a
by (meson local.nonzero_eq_divide_eq)
have f6: "0 < z"
using a2 a1 less_le_trans by blast
have "z \<noteq> 0"
using a2 a1 by (meson local.leD)
moreover have "x / z \<noteq> y / w"
using a1 a2 a3 a4 local.frac_eq_eq local.mult_less_le_imp_less by fastforce
ultimately have "x / z \<noteq> y / w"
using f5 by (metis (no_types))
thus ?thesis
using a4 a3 a2 a1 by (meson local.frac_le local.order.not_eq_order_implies_strict
local.order.strict_implies_order)
qed
lemma frac_less2: "0 < x \<Longrightarrow> x \<le> y \<Longrightarrow> 0 < w \<Longrightarrow> w < z \<Longrightarrow> x / z < y / w"
by (metis local.antisym_conv2 local.divide_cancel_left local.dual_order.strict_implies_order
local.frac_le local.frac_less)
lemma less_half_sum: "a < b \<Longrightarrow> a < (a+b) / (1+1)"
by (metis local.add_pos_pos local.add_strict_left_mono local.mult_imp_less_div_pos local.semiring_normalization_rules(4) local.zero_less_one mult_commute)
lemma gt_half_sum: "a < b \<Longrightarrow> (a+b)/(1+1) < b"
by (metis local.add_pos_pos local.add_strict_left_mono local.mult_imp_div_pos_less local.semiring_normalization_rules(24) local.semiring_normalization_rules(4) local.zero_less_one mult_commute)
subclass unbounded_dense_order
proof
fix x y :: 'a
have less_add_one: "a < a + 1" for a::'a by auto
from less_add_one show "\<exists>y. x < y"
by blast
from less_add_one have "x + (- 1) < (x + 1) + (- 1)"
by (rule add_strict_right_mono)
hence "x - 1 < x + 1 - 1" by simp
hence "x - 1 < x" by (simp add: algebra_simps)
thus "\<exists>y. y < x" ..
show "x < y \<Longrightarrow> \<exists>z>x. z < y" by (blast intro!: less_half_sum gt_half_sum)
qed
lemma dense_le_bounded:
fixes x y z :: 'a
assumes "x < y"
and *: "\<And>w. \<lbrakk> x < w ; w < y \<rbrakk> \<Longrightarrow> w \<le> z"
shows "y \<le> z"
proof (rule dense_le)
fix w assume "w < y"
from dense[OF \<open>x < y\<close>] obtain u where "x < u" "u < y" by safe
have "u \<le> w \<or> w \<le> u"
using \<open>u < y\<close> \<open>w < y\<close> comparable local.order.strict_implies_order by blast
thus "w \<le> z"
using "*" \<open>u < y\<close> \<open>w < y\<close> \<open>x < u\<close> local.dual_order.trans local.order.strict_trans2 by blast
qed
subclass field_abs_sgn ..
lemma nonzero_abs_inverse:
"a \<noteq> 0 \<Longrightarrow> \<bar>inverse a\<bar> = inverse \<bar>a\<bar>"
by (rule abs_inverse)
lemma nonzero_abs_divide:
"b \<noteq> 0 \<Longrightarrow> \<bar>a / b\<bar> = \<bar>a\<bar> / \<bar>b\<bar>"
by (rule abs_divide)
lemma field_le_epsilon:
assumes e: "\<And>e. 0 < e \<Longrightarrow> x \<le> y + e"
shows "x \<le> y"
proof (rule dense_le)
fix t assume "t < x"
hence "0 < x - t" by (simp add: less_diff_eq)
from e [OF this] have "x + 0 \<le> x + (y - t)" by (simp add: algebra_simps)
hence "0 \<le> y - t" by (simp only: add_le_cancel_left)
thus "t \<le> y" by (simp add: algebra_simps)
qed
lemma inverse_positive_iff_positive [simp]:
"(0 < inverse a) = (0 < a)"
using local.positive_imp_inverse_positive by fastforce
lemma inverse_negative_iff_negative [simp]:
"(inverse a < 0) = (a < 0)"
using local.negative_imp_inverse_negative by fastforce
lemma inverse_nonnegative_iff_nonnegative [simp]:
"0 \<le> inverse a \<longleftrightarrow> 0 \<le> a"
by (simp add: local.dual_order.order_iff_strict)
lemma inverse_nonpositive_iff_nonpositive [simp]:
"inverse a \<le> 0 \<longleftrightarrow> a \<le> 0"
using local.inverse_nonnegative_iff_nonnegative local.neg_0_le_iff_le by fastforce
lemma one_less_inverse_iff: "1 < inverse x \<longleftrightarrow> 0 < x \<and> x < 1"
using less_trans[of 1 x 0 for x]
by (metis local.dual_order.strict_trans local.inverse_1 local.inverse_less_imp_less local.inverse_positive_iff_positive local.one_less_inverse local.zero_less_one)
lemma one_le_inverse_iff: "1 \<le> inverse x \<longleftrightarrow> 0 < x \<and> x \<le> 1"
by (metis local.dual_order.strict_trans1 local.inverse_1 local.inverse_le_imp_le local.inverse_positive_iff_positive local.one_le_inverse local.zero_less_one)
lemma inverse_less_1_iff: "inverse x < 1 \<longleftrightarrow> x \<le> 0 \<or> 1 < x"
proof (rule)
assume invx1: "inverse x < 1"
have "inverse x \<le> 0 \<or> inverse x \<ge> 0"
using comparable invx1 local.order.strict_implies_order local.zero_less_one by blast
then consider (leq0) "inverse x \<le> 0" | (pos) "inverse x > 0" | (zero) "inverse x = 0"
using local.antisym_conv1 by blast
thus "x \<le> 0 \<or> 1 < x"
by (metis invx1 local.eq_refl local.inverse_1 inverse_less_imp_less
inverse_nonpositive_iff_nonpositive inverse_positive_iff_positive)
next
assume "x \<le> 0 \<or> 1 < x"
then consider (neg) "x \<le> 0" | (g1) "1 < x" by auto
thus "inverse x < 1"
by (metis local.dual_order.not_eq_order_implies_strict local.dual_order.strict_trans
local.inverse_1 local.inverse_negative_iff_negative local.inverse_zero
local.less_imp_inverse_less local.zero_less_one)
qed
lemma inverse_le_1_iff: "inverse x \<le> 1 \<longleftrightarrow> x \<le> 0 \<or> 1 \<le> x"
by (metis local.dual_order.order_iff_strict local.inverse_1 local.inverse_le_iff_le
local.inverse_less_1_iff local.one_le_inverse_iff)
text\<open>Simplify expressions such as \<open>0 < 1/x\<close> to \<open>0 < x\<close>\<close>
lemma zero_le_divide_1_iff [simp]:
"0 \<le> 1 / a \<longleftrightarrow> 0 \<le> a"
using local.dual_order.order_iff_strict local.inverse_eq_divide
local.inverse_positive_iff_positive by auto
lemma zero_less_divide_1_iff [simp]:
"0 < 1 / a \<longleftrightarrow> 0 < a"
by (simp add: local.dual_order.strict_iff_order)
lemma divide_le_0_1_iff [simp]:
"1 / a \<le> 0 \<longleftrightarrow> a \<le> 0"
by (smt local.abs_0 local.abs_1 local.abs_divide local.abs_neg local.abs_nn
local.divide_cancel_left local.le_minus_iff local.minus_divide_right local.zero_neq_one)
lemma divide_less_0_1_iff [simp]:
"1 / a < 0 \<longleftrightarrow> a < 0"
using local.dual_order.strict_iff_order by auto
lemma divide_right_mono:
"a \<le> b \<Longrightarrow> 0 \<le> c \<Longrightarrow> a/c \<le> b/c"
using local.divide_cancel_right local.divide_strict_right_mono local.dual_order.order_iff_strict by blast
lemma divide_right_mono_neg: "a \<le> b
\<Longrightarrow> c \<le> 0 \<Longrightarrow> b / c \<le> a / c"
by (metis local.divide_cancel_right local.divide_strict_right_mono_neg local.dual_order.strict_implies_order local.eq_refl local.le_imp_less_or_eq)
lemma divide_left_mono_neg: "a \<le> b
\<Longrightarrow> c \<le> 0 \<Longrightarrow> 0 < a * b \<Longrightarrow> c / a \<le> c / b"
by (metis local.divide_left_mono local.minus_divide_left local.neg_0_le_iff_le local.neg_le_iff_le mult_commute)
lemma divide_nonneg_nonneg [simp]:
"0 \<le> x \<Longrightarrow> 0 \<le> y \<Longrightarrow> 0 \<le> x / y"
using local.divide_eq_0_iff local.divide_nonneg_pos local.dual_order.order_iff_strict by blast
lemma divide_nonpos_nonpos:
"x \<le> 0 \<Longrightarrow> y \<le> 0 \<Longrightarrow> 0 \<le> x / y"
using local.divide_nonpos_neg local.dual_order.order_iff_strict by auto
lemma divide_nonneg_nonpos:
"0 \<le> x \<Longrightarrow> y \<le> 0 \<Longrightarrow> x / y \<le> 0"
by (metis local.divide_eq_0_iff local.divide_nonneg_neg local.dual_order.order_iff_strict)
lemma divide_nonpos_nonneg:
"x \<le> 0 \<Longrightarrow> 0 \<le> y \<Longrightarrow> x / y \<le> 0"
using local.divide_nonpos_pos local.dual_order.order_iff_strict by auto
text \<open>Conditional Simplification Rules: No Case Splits\<close>
lemma le_divide_eq_1_pos [simp]:
"0 < a \<Longrightarrow> (1 \<le> b/a) = (a \<le> b)"
by (simp add: local.pos_le_divide_eq)
lemma le_divide_eq_1_neg [simp]:
"a < 0 \<Longrightarrow> (1 \<le> b/a) = (b \<le> a)"
by (metis local.le_divide_eq_1_pos local.minus_divide_divide local.neg_0_less_iff_less local.neg_le_iff_le)
lemma divide_le_eq_1_pos [simp]:
"0 < a \<Longrightarrow> (b/a \<le> 1) = (b \<le> a)"
using local.pos_divide_le_eq by auto
lemma divide_le_eq_1_neg [simp]:
"a < 0 \<Longrightarrow> (b/a \<le> 1) = (a \<le> b)"
by (metis local.divide_le_eq_1_pos local.minus_divide_divide local.neg_0_less_iff_less
local.neg_le_iff_le)
lemma less_divide_eq_1_pos [simp]:
"0 < a \<Longrightarrow> (1 < b/a) = (a < b)"
by (simp add: local.dual_order.strict_iff_order)
lemma less_divide_eq_1_neg [simp]:
"a < 0 \<Longrightarrow> (1 < b/a) = (b < a)"
using local.dual_order.strict_iff_order by auto
lemma divide_less_eq_1_pos [simp]:
"0 < a \<Longrightarrow> (b/a < 1) = (b < a)"
using local.divide_le_eq_1_pos local.dual_order.strict_iff_order by auto
lemma divide_less_eq_1_neg [simp]:
"a < 0 \<Longrightarrow> b/a < 1 \<longleftrightarrow> a < b"
using local.dual_order.strict_iff_order by auto
lemma abs_div_pos: "0 < y \<Longrightarrow>
\<bar>x\<bar> / y = \<bar>x / y\<bar>"
by (simp add: local.abs_pos)
lemma zero_le_divide_abs_iff [simp]: "(0 \<le> a / \<bar>b\<bar>) = (0 \<le> a | b = 0)"
proof
assume assm: "0 \<le> a / \<bar>b\<bar>"
have absb: "abs b \<ge> 0" by (fact abs_nn)
thus "0 \<le> a \<or> b = 0"
using absb assm local.abs_eq_0_iff local.mult_nonneg_nonneg by fastforce
next
assume "0 \<le> a \<or> b = 0"
then consider (a) "0 \<le> a" | (b) "b = 0" by atomize_elim auto
thus "0 \<le> a / \<bar>b\<bar>"
by (metis local.abs_eq_0_iff local.abs_nn local.divide_eq_0_iff local.divide_nonneg_nonneg)
qed
lemma divide_le_0_abs_iff [simp]: "(a / \<bar>b\<bar> \<le> 0) = (a \<le> 0 | b = 0)"
by (metis local.minus_divide_left local.neg_0_le_iff_le local.zero_le_divide_abs_iff)
text\<open>For creating values between \<^term>\<open>u\<close> and \<^term>\<open>v\<close>.\<close>
lemma scaling_mono:
assumes "u \<le> v" and "0 \<le> r" and "r \<le> s"
shows "u + r * (v - u) / s \<le> v"
proof -
have "r/s \<le> 1" using assms
by (metis local.divide_le_eq_1_pos local.division_ring_divide_zero
local.dual_order.order_iff_strict local.dual_order.trans local.zero_less_one)
hence "(r/s) * (v - u) \<le> 1 * (v - u)"
using assms(1) local.diff_ge_0_iff_ge local.mult_right_mono by blast
thus ?thesis
by (simp add: field_simps)
qed
end (* class nice_ordered_field *)
code_identifier
code_module Ordered_Fields \<rightharpoonup> (SML) Arith and (OCaml) Arith and (Haskell) Arith
subsection \<open>Ordering on complex numbers\<close>
instantiation complex :: nice_ordered_field begin
instance
proof intro_classes
note defs = less_eq_complex_def less_complex_def abs_complex_def
fix x y z a b c :: complex
show "a \<le> 0 \<Longrightarrow> \<bar>a\<bar> = - a" unfolding defs
by (simp add: cmod_eq_Re complex_is_Real_iff)
show "0 \<le> a \<Longrightarrow> \<bar>a\<bar> = a"
unfolding defs
by (metis abs_of_nonneg cmod_eq_Re comp_apply complex.exhaust_sel complex_of_real_def zero_complex.simps(1) zero_complex.simps(2))
show "a < b \<Longrightarrow> 0 < c \<Longrightarrow> c * a < c * b" unfolding defs by auto
show "0 < (1::complex)" unfolding defs by simp
show "0 < a \<Longrightarrow> 0 < inverse a" unfolding defs by auto
define ra ia rb ib rc ic where "ra = Re a" "ia = Im a" "rb = Re b" "ib = Im b" "rc = Re c" "ic = Im c"
note ri = this[symmetric]
hence "a = Complex ra ia" "b = Complex rb ib" "c = Complex rc ic" by auto
note ri = this ri
have "rb \<le> ra"
if "1 / ra \<le> (if rb = 0 then 0 else 1 / rb)"
and "ia = 0" and "0 < ra" and "ib = 0"
proof(cases "rb = 0")
case True
thus ?thesis
using that(3) by auto
next
case False
thus ?thesis
by (smt nice_ordered_field_class.frac_less2 that(1) that(3))
qed
thus "inverse a \<le> inverse b \<Longrightarrow> 0 < a \<Longrightarrow> b \<le> a" unfolding defs ri
by (auto simp: power2_eq_square)
show "(\<And>a. a < b \<Longrightarrow> a \<le> c) \<Longrightarrow> b \<le> c" unfolding defs ri
by (metis complex.sel(1) complex.sel(2) dense less_le_not_le
nice_ordered_field_class.linordered_field_no_lb not_le_imp_less)
show "0 \<le> a \<Longrightarrow> 0 \<le> b \<Longrightarrow> a \<le> b \<or> b \<le> a" unfolding defs by auto
show "0 \<le> \<bar>x\<bar>" unfolding defs by auto
qed
end
lemma less_eq_complexI: "Re x \<le> Re y \<Longrightarrow> Im x = Im y \<Longrightarrow> x\<le>y" unfolding less_eq_complex_def
by simp
lemma less_complexI: "Re x < Re y \<Longrightarrow> Im x = Im y \<Longrightarrow> x<y" unfolding less_complex_def
by simp
lemma complex_of_real_mono:
"x \<le> y \<Longrightarrow> complex_of_real x \<le> complex_of_real y"
unfolding less_eq_complex_def by auto
lemma complex_of_real_mono_iff[simp]:
"complex_of_real x \<le> complex_of_real y \<longleftrightarrow> x \<le> y"
unfolding less_eq_complex_def by auto
lemma complex_of_real_strict_mono_iff[simp]:
"complex_of_real x < complex_of_real y \<longleftrightarrow> x < y"
unfolding less_complex_def by auto
lemma complex_of_real_nn_iff[simp]:
"0 \<le> complex_of_real y \<longleftrightarrow> 0 \<le> y"
unfolding less_eq_complex_def by auto
lemma complex_of_real_pos_iff[simp]:
"0 < complex_of_real y \<longleftrightarrow> 0 < y"
unfolding less_complex_def by auto
lemma Re_mono: "x \<le> y \<Longrightarrow> Re x \<le> Re y"
unfolding less_eq_complex_def by simp
lemma comp_Im_same: "x \<le> y \<Longrightarrow> Im x = Im y"
unfolding less_eq_complex_def by simp
lemma Re_strict_mono: "x < y \<Longrightarrow> Re x < Re y"
unfolding less_complex_def by simp
lemma complex_of_real_cmod: assumes "x \<ge> 0" shows "complex_of_real (cmod x) = x"
by (metis Reals_cases abs_of_nonneg assms comp_Im_same complex_is_Real_iff complex_of_real_nn_iff norm_of_real zero_complex.simps(2))
end
|
(* Copyright (c) 2014, Robert Dockins *)
Require Import List.
Require Import Domains.basics.
Require Import Domains.categories.
Require Import Domains.preord.
Require Import Domains.sets.
Require Import Domains.finsets.
Require Import Domains.esets.
Require Import Domains.effective.
Require Import Domains.plotkin.
Require Import Domains.profinite.
Require Import Domains.embed.
Require Import Domains.joinable.
Require Import Domains.directed.
Require Import Domains.cont_functors.
Require Import Domains.bilimit.
Require Import Domains.exp_functor.
Require Import Domains.profinite_adj.
Require Import Domains.cont_adj.
Notation Ue := liftEMBED.
Notation Le := forgetEMBED.
(** * Models of untyped λ-calculi
*)
Definition eagerLamF : functor (EMBED true) (EMBED true)
:= expF true ∘ pairF id id.
Definition cbvLamF : functor (EMBED true) (EMBED true)
:= Le ∘ Ue ∘ expF true ∘ pairF id id.
Definition cbnLamF : functor (EMBED true) (EMBED true)
:= Le ∘ expF false ∘ pairF id id ∘ Ue.
Lemma eagerLamF_continuous : continuous_functor eagerLamF.
Proof.
unfold eagerLamF.
apply composeF_continuous.
apply expF_continuous.
apply pairF_continuous.
apply identF_continuous.
apply identF_continuous.
Qed.
Lemma cbvLamF_continuous : continuous_functor cbvLamF.
Proof.
unfold cbvLamF.
apply composeF_continuous.
apply composeF_continuous.
apply composeF_continuous.
apply forgetEMBED_continuous.
apply liftEMBED_continuous.
apply expF_continuous.
apply pairF_continuous.
apply identF_continuous.
apply identF_continuous.
Qed.
Lemma cbnLamF_continuous : continuous_functor cbnLamF.
Proof.
unfold cbnLamF.
apply composeF_continuous.
apply composeF_continuous.
apply composeF_continuous.
apply forgetEMBED_continuous.
apply expF_continuous.
apply pairF_continuous.
apply identF_continuous.
apply identF_continuous.
apply liftEMBED_continuous.
Qed.
Definition lamModelEager : ∂PLT := fixpoint eagerLamF.
Definition lamModelCBV : ∂PLT := fixpoint cbvLamF.
Definition lamModelCBN : ∂PLT := fixpoint cbnLamF.
Lemma lamModelEager_iso :
((lamModelEager ⊸ lamModelEager) : ob (EMBED true)) ↔ lamModelEager.
Proof.
apply (fixpoint_iso eagerLamF).
apply eagerLamF_continuous.
Qed.
Lemma lamModelCBV_iso :
(colift (lamModelCBV ⊸ lamModelCBV) : ob (EMBED true)) ↔ lamModelCBV.
Proof.
apply (fixpoint_iso cbvLamF).
apply cbvLamF_continuous.
Qed.
Lemma lamModelCBN_iso :
(L (U lamModelCBN ⇒ U lamModelCBN) : ob (EMBED true)) ↔ lamModelCBN.
Proof.
apply (fixpoint_iso cbnLamF).
apply cbnLamF_continuous.
Qed.
(* We can also directly construct a model of lambdas in total PLT...
but this seems to be the trivial one-point model.
Program Definition lamModelIn : PLT.unit false ⇀ lamF false (PLT.unit false) :=
Embedding false (PLT.unit false) (lamF false (PLT.unit false))
(fun x => exist _ ((tt,tt)::nil) _) _ _ _ _.
Next Obligation.
repeat intro.
hnf. split. hnf; auto.
simpl. intros. exists tt.
destruct x0. split; auto.
apply cons_elem. auto.
hnf; simpl; intros.
hnf; auto.
Qed.
Next Obligation.
hnf; simpl; intros.
red. hnf. simpl. intros.
exists tt. exists tt.
split.
apply cons_elem; auto.
split; hnf; auto.
Qed.
Next Obligation.
repeat intro; hnf; auto.
Qed.
Next Obligation.
intros. exists tt.
simpl. hnf; auto.
simpl; intros.
exists tt. exists tt.
split.
destruct y. simpl.
destruct i.
simpl in H1.
destruct (H1 x) with tt; auto.
hnf; auto.
split.
hnf. intros; hnf; auto.
intros; hnf; auto.
destruct H2. destruct x0; auto.
split; hnf; auto.
Qed.
Next Obligation.
hnf; simpl. intros.
exists tt.
split; hnf; auto.
split; hnf; auto.
Qed.
Definition lamModelCBN : ob PLT
:= fixpoint_alt (lamF false) (PLT.unit false) lamModelIn.
Lemma lamModelCBN_iso : (PLT.exp lamModelCBN lamModelCBN : ob (EMBED false)) ↔ lamModelCBN.
Proof.
apply (fixpoint_alt_iso (lamF false)).
apply lamF_continuous.
Qed.
*)
|
-- Copyright 2017, the blau.io contributors
--
-- 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.
module API.Web.XHR.XMLHttpRequest
import IdrisScript
%access public export
%default total
record XMLHttpRequest where
constructor NewXMLRequest
||| self is a non-standard field to faciliate integration with JavaScript
self : JSRef
open : XMLHttpRequest -> (method : String) -> (url : String) -> JS_IO ()
open xhr = jscall "%0.open(%1, %2)" (JSRef -> String -> String -> JS_IO ()) $
self xhr
send : XMLHttpRequest -> JS_IO ()
send xhr = jscall "%0.send()" (JSRef -> JS_IO ()) $ self xhr
-- TODO: No options yet, callback is missing event, etc. This should really live
-- somewhere else, but I'm under time pressure for LD38.
partial
addEventListener : XMLHttpRequest -> (type : String) ->
(cb : (XMLHttpRequest -> JS_IO ())) -> JS_IO ()
addEventListener (NewXMLRequest self) type cb = addEventListener' where
callback : () -> JS_IO ()
callback _ = cb $ NewXMLRequest self
partial
addEventListener' : JS_IO ()
addEventListener' = jscall "%0.addEventListener(%1, %2)"
(JSRef -> String -> JsFn (() -> JS_IO ()) -> JS_IO ()) self type $
MkJsFn callback
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johannes Hölzl, Patrick Massot, Sébastien Gouëzel, Zhouhang Zhou, Reid Barton
-/
import logic.equiv.fin
import topology.dense_embedding
import topology.support
/-!
# Homeomorphisms
> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
> Any changes to this file require a corresponding PR to mathlib4.
This file defines homeomorphisms between two topological spaces. They are bijections with both
directions continuous. We denote homeomorphisms with the notation `≃ₜ`.
# Main definitions
* `homeomorph α β`: The type of homeomorphisms from `α` to `β`.
This type can be denoted using the following notation: `α ≃ₜ β`.
# Main results
* Pretty much every topological property is preserved under homeomorphisms.
* `homeomorph.homeomorph_of_continuous_open`: A continuous bijection that is
an open map is a homeomorphism.
-/
open set filter
open_locale topology
variables {α : Type*} {β : Type*} {γ : Type*} {δ : Type*}
/-- Homeomorphism between `α` and `β`, also called topological isomorphism -/
@[nolint has_nonempty_instance] -- not all spaces are homeomorphic to each other
structure homeomorph (α : Type*) (β : Type*) [topological_space α] [topological_space β]
extends α ≃ β :=
(continuous_to_fun : continuous to_fun . tactic.interactive.continuity')
(continuous_inv_fun : continuous inv_fun . tactic.interactive.continuity')
infix ` ≃ₜ `:25 := homeomorph
namespace homeomorph
variables [topological_space α] [topological_space β] [topological_space γ] [topological_space δ]
instance : has_coe_to_fun (α ≃ₜ β) (λ _, α → β) := ⟨λe, e.to_equiv⟩
@[simp] lemma homeomorph_mk_coe (a : equiv α β) (b c) :
((homeomorph.mk a b c) : α → β) = a :=
rfl
/-- Inverse of a homeomorphism. -/
protected def symm (h : α ≃ₜ β) : β ≃ₜ α :=
{ continuous_to_fun := h.continuous_inv_fun,
continuous_inv_fun := h.continuous_to_fun,
to_equiv := h.to_equiv.symm }
/-- See Note [custom simps projection]. We need to specify this projection explicitly in this case,
because it is a composition of multiple projections. -/
def simps.apply (h : α ≃ₜ β) : α → β := h
/-- See Note [custom simps projection] -/
def simps.symm_apply (h : α ≃ₜ β) : β → α := h.symm
initialize_simps_projections homeomorph
(to_equiv_to_fun → apply, to_equiv_inv_fun → symm_apply, -to_equiv)
@[simp] lemma coe_to_equiv (h : α ≃ₜ β) : ⇑h.to_equiv = h := rfl
@[simp] lemma coe_symm_to_equiv (h : α ≃ₜ β) : ⇑h.to_equiv.symm = h.symm := rfl
lemma to_equiv_injective : function.injective (to_equiv : α ≃ₜ β → α ≃ β)
| ⟨e, h₁, h₂⟩ ⟨e', h₁', h₂'⟩ rfl := rfl
@[ext] lemma ext {h h' : α ≃ₜ β} (H : ∀ x, h x = h' x) : h = h' :=
to_equiv_injective $ equiv.ext H
@[simp] lemma symm_symm (h : α ≃ₜ β) : h.symm.symm = h := ext $ λ _, rfl
/-- Identity map as a homeomorphism. -/
@[simps apply {fully_applied := ff}]
protected def refl (α : Type*) [topological_space α] : α ≃ₜ α :=
{ continuous_to_fun := continuous_id,
continuous_inv_fun := continuous_id,
to_equiv := equiv.refl α }
/-- Composition of two homeomorphisms. -/
protected def trans (h₁ : α ≃ₜ β) (h₂ : β ≃ₜ γ) : α ≃ₜ γ :=
{ continuous_to_fun := h₂.continuous_to_fun.comp h₁.continuous_to_fun,
continuous_inv_fun := h₁.continuous_inv_fun.comp h₂.continuous_inv_fun,
to_equiv := equiv.trans h₁.to_equiv h₂.to_equiv }
@[simp] lemma trans_apply (h₁ : α ≃ₜ β) (h₂ : β ≃ₜ γ) (a : α) : h₁.trans h₂ a = h₂ (h₁ a) := rfl
@[simp] lemma homeomorph_mk_coe_symm (a : equiv α β) (b c) :
((homeomorph.mk a b c).symm : β → α) = a.symm :=
rfl
@[simp] lemma refl_symm : (homeomorph.refl α).symm = homeomorph.refl α := rfl
@[continuity]
protected lemma continuous (h : α ≃ₜ β) : continuous h := h.continuous_to_fun
@[continuity] -- otherwise `by continuity` can't prove continuity of `h.to_equiv.symm`
protected lemma continuous_symm (h : α ≃ₜ β) : continuous (h.symm) := h.continuous_inv_fun
@[simp] lemma apply_symm_apply (h : α ≃ₜ β) (x : β) : h (h.symm x) = x :=
h.to_equiv.apply_symm_apply x
@[simp] lemma symm_apply_apply (h : α ≃ₜ β) (x : α) : h.symm (h x) = x :=
h.to_equiv.symm_apply_apply x
@[simp] lemma self_trans_symm (h : α ≃ₜ β) : h.trans h.symm = homeomorph.refl α :=
by { ext, apply symm_apply_apply }
@[simp] lemma symm_trans_self (h : α ≃ₜ β) : h.symm.trans h = homeomorph.refl β :=
by { ext, apply apply_symm_apply }
protected lemma bijective (h : α ≃ₜ β) : function.bijective h := h.to_equiv.bijective
protected lemma injective (h : α ≃ₜ β) : function.injective h := h.to_equiv.injective
protected lemma surjective (h : α ≃ₜ β) : function.surjective h := h.to_equiv.surjective
/-- Change the homeomorphism `f` to make the inverse function definitionally equal to `g`. -/
def change_inv (f : α ≃ₜ β) (g : β → α) (hg : function.right_inverse g f) : α ≃ₜ β :=
have g = f.symm, from funext (λ x, calc g x = f.symm (f (g x)) : (f.left_inv (g x)).symm
... = f.symm x : by rw hg x),
{ to_fun := f,
inv_fun := g,
left_inv := by convert f.left_inv,
right_inv := by convert f.right_inv,
continuous_to_fun := f.continuous,
continuous_inv_fun := by convert f.symm.continuous }
@[simp] lemma symm_comp_self (h : α ≃ₜ β) : ⇑h.symm ∘ ⇑h = id :=
funext h.symm_apply_apply
@[simp] lemma self_comp_symm (h : α ≃ₜ β) : ⇑h ∘ ⇑h.symm = id :=
funext h.apply_symm_apply
@[simp] lemma range_coe (h : α ≃ₜ β) : range h = univ :=
h.surjective.range_eq
lemma image_symm (h : α ≃ₜ β) : image h.symm = preimage h :=
funext h.symm.to_equiv.image_eq_preimage
lemma preimage_symm (h : α ≃ₜ β) : preimage h.symm = image h :=
(funext h.to_equiv.image_eq_preimage).symm
@[simp] lemma image_preimage (h : α ≃ₜ β) (s : set β) : h '' (h ⁻¹' s) = s :=
h.to_equiv.image_preimage s
@[simp] lemma preimage_image (h : α ≃ₜ β) (s : set α) : h ⁻¹' (h '' s) = s :=
h.to_equiv.preimage_image s
protected lemma inducing (h : α ≃ₜ β) : inducing h :=
inducing_of_inducing_compose h.continuous h.symm.continuous $
by simp only [symm_comp_self, inducing_id]
lemma induced_eq (h : α ≃ₜ β) : topological_space.induced h ‹_› = ‹_› := h.inducing.1.symm
protected lemma quotient_map (h : α ≃ₜ β) : quotient_map h :=
quotient_map.of_quotient_map_compose h.symm.continuous h.continuous $
by simp only [self_comp_symm, quotient_map.id]
lemma coinduced_eq (h : α ≃ₜ β) : topological_space.coinduced h ‹_› = ‹_› :=
h.quotient_map.2.symm
protected lemma embedding (h : α ≃ₜ β) : embedding h :=
⟨h.inducing, h.injective⟩
/-- Homeomorphism given an embedding. -/
noncomputable def of_embedding (f : α → β) (hf : embedding f) : α ≃ₜ (set.range f) :=
{ continuous_to_fun := hf.continuous.subtype_mk _,
continuous_inv_fun := by simp [hf.continuous_iff, continuous_subtype_coe],
to_equiv := equiv.of_injective f hf.inj }
protected lemma second_countable_topology [topological_space.second_countable_topology β]
(h : α ≃ₜ β) :
topological_space.second_countable_topology α :=
h.inducing.second_countable_topology
lemma is_compact_image {s : set α} (h : α ≃ₜ β) : is_compact (h '' s) ↔ is_compact s :=
h.embedding.is_compact_iff_is_compact_image.symm
lemma is_compact_preimage {s : set β} (h : α ≃ₜ β) : is_compact (h ⁻¹' s) ↔ is_compact s :=
by rw ← image_symm; exact h.symm.is_compact_image
@[simp] lemma comap_cocompact (h : α ≃ₜ β) : comap h (cocompact β) = cocompact α :=
(comap_cocompact_le h.continuous).antisymm $
(has_basis_cocompact.le_basis_iff (has_basis_cocompact.comap h)).2 $ λ K hK,
⟨h ⁻¹' K, h.is_compact_preimage.2 hK, subset.rfl⟩
@[simp] lemma map_cocompact (h : α ≃ₜ β) : map h (cocompact α) = cocompact β :=
by rw [← h.comap_cocompact, map_comap_of_surjective h.surjective]
protected lemma compact_space [compact_space α] (h : α ≃ₜ β) : compact_space β :=
{ is_compact_univ := by { rw [← image_univ_of_surjective h.surjective, h.is_compact_image],
apply compact_space.is_compact_univ } }
protected lemma t0_space [t0_space α] (h : α ≃ₜ β) : t0_space β :=
h.symm.embedding.t0_space
protected lemma t1_space [t1_space α] (h : α ≃ₜ β) : t1_space β :=
h.symm.embedding.t1_space
protected lemma t2_space [t2_space α] (h : α ≃ₜ β) : t2_space β :=
h.symm.embedding.t2_space
protected lemma t3_space [t3_space α] (h : α ≃ₜ β) : t3_space β :=
h.symm.embedding.t3_space
protected lemma dense_embedding (h : α ≃ₜ β) : dense_embedding h :=
{ dense := h.surjective.dense_range,
.. h.embedding }
@[simp] lemma is_open_preimage (h : α ≃ₜ β) {s : set β} : is_open (h ⁻¹' s) ↔ is_open s :=
h.quotient_map.is_open_preimage
@[simp] lemma is_open_image (h : α ≃ₜ β) {s : set α} : is_open (h '' s) ↔ is_open s :=
by rw [← preimage_symm, is_open_preimage]
protected lemma is_open_map (h : α ≃ₜ β) : is_open_map h := λ s, h.is_open_image.2
@[simp] lemma is_closed_preimage (h : α ≃ₜ β) {s : set β} : is_closed (h ⁻¹' s) ↔ is_closed s :=
by simp only [← is_open_compl_iff, ← preimage_compl, is_open_preimage]
@[simp] lemma is_closed_image (h : α ≃ₜ β) {s : set α} : is_closed (h '' s) ↔ is_closed s :=
by rw [← preimage_symm, is_closed_preimage]
protected lemma is_closed_map (h : α ≃ₜ β) : is_closed_map h := λ s, h.is_closed_image.2
protected lemma open_embedding (h : α ≃ₜ β) : open_embedding h :=
open_embedding_of_embedding_open h.embedding h.is_open_map
protected lemma closed_embedding (h : α ≃ₜ β) : closed_embedding h :=
closed_embedding_of_embedding_closed h.embedding h.is_closed_map
protected lemma normal_space [normal_space α] (h : α ≃ₜ β) : normal_space β :=
h.symm.closed_embedding.normal_space
lemma preimage_closure (h : α ≃ₜ β) (s : set β) : h ⁻¹' (closure s) = closure (h ⁻¹' s) :=
h.is_open_map.preimage_closure_eq_closure_preimage h.continuous _
lemma image_closure (h : α ≃ₜ β) (s : set α) : h '' (closure s) = closure (h '' s) :=
by rw [← preimage_symm, preimage_closure]
lemma image_interior (h : α ≃ₜ β) (s : set α) : h '' (interior s) = interior (h '' s) :=
by rw [← preimage_symm, preimage_interior]
lemma preimage_frontier (h : α ≃ₜ β) (s : set β) : h ⁻¹' (frontier s) = frontier (h ⁻¹' s) :=
h.is_open_map.preimage_frontier_eq_frontier_preimage h.continuous _
lemma image_frontier (h : α ≃ₜ β) (s : set α) : h '' frontier s = frontier (h '' s) :=
by rw [←preimage_symm, preimage_frontier]
@[to_additive]
lemma _root_.has_compact_mul_support.comp_homeomorph {M} [has_one M] {f : β → M}
(hf : has_compact_mul_support f) (φ : α ≃ₜ β) : has_compact_mul_support (f ∘ φ) :=
hf.comp_closed_embedding φ.closed_embedding
@[simp] lemma map_nhds_eq (h : α ≃ₜ β) (x : α) : map h (𝓝 x) = 𝓝 (h x) :=
h.embedding.map_nhds_of_mem _ (by simp)
lemma symm_map_nhds_eq (h : α ≃ₜ β) (x : α) : map h.symm (𝓝 (h x)) = 𝓝 x :=
by rw [h.symm.map_nhds_eq, h.symm_apply_apply]
lemma nhds_eq_comap (h : α ≃ₜ β) (x : α) : 𝓝 x = comap h (𝓝 (h x)) :=
h.embedding.to_inducing.nhds_eq_comap x
@[simp] lemma comap_nhds_eq (h : α ≃ₜ β) (y : β) : comap h (𝓝 y) = 𝓝 (h.symm y) :=
by rw [h.nhds_eq_comap, h.apply_symm_apply]
/-- If an bijective map `e : α ≃ β` is continuous and open, then it is a homeomorphism. -/
def homeomorph_of_continuous_open (e : α ≃ β) (h₁ : continuous e) (h₂ : is_open_map e) :
α ≃ₜ β :=
{ continuous_to_fun := h₁,
continuous_inv_fun := begin
rw continuous_def,
intros s hs,
convert ← h₂ s hs using 1,
apply e.image_eq_preimage
end,
to_equiv := e }
@[simp] lemma comp_continuous_on_iff (h : α ≃ₜ β) (f : γ → α) (s : set γ) :
continuous_on (h ∘ f) s ↔ continuous_on f s :=
h.inducing.continuous_on_iff.symm
@[simp] lemma comp_continuous_iff (h : α ≃ₜ β) {f : γ → α} :
continuous (h ∘ f) ↔ continuous f :=
h.inducing.continuous_iff.symm
@[simp] lemma comp_continuous_iff' (h : α ≃ₜ β) {f : β → γ} :
continuous (f ∘ h) ↔ continuous f :=
h.quotient_map.continuous_iff.symm
lemma comp_continuous_at_iff (h : α ≃ₜ β) (f : γ → α) (x : γ) :
continuous_at (h ∘ f) x ↔ continuous_at f x :=
h.inducing.continuous_at_iff.symm
lemma comp_continuous_at_iff' (h : α ≃ₜ β) (f : β → γ) (x : α) :
continuous_at (f ∘ h) x ↔ continuous_at f (h x) :=
h.inducing.continuous_at_iff' (by simp)
lemma comp_continuous_within_at_iff (h : α ≃ₜ β) (f : γ → α) (s : set γ) (x : γ) :
continuous_within_at f s x ↔ continuous_within_at (h ∘ f) s x :=
h.inducing.continuous_within_at_iff
@[simp] lemma comp_is_open_map_iff (h : α ≃ₜ β) {f : γ → α} :
is_open_map (h ∘ f) ↔ is_open_map f :=
begin
refine ⟨_, λ hf, h.is_open_map.comp hf⟩,
intros hf,
rw [← function.comp.left_id f, ← h.symm_comp_self, function.comp.assoc],
exact h.symm.is_open_map.comp hf,
end
@[simp] lemma comp_is_open_map_iff' (h : α ≃ₜ β) {f : β → γ} :
is_open_map (f ∘ h) ↔ is_open_map f :=
begin
refine ⟨_, λ hf, hf.comp h.is_open_map⟩,
intros hf,
rw [← function.comp.right_id f, ← h.self_comp_symm, ← function.comp.assoc],
exact hf.comp h.symm.is_open_map,
end
/-- If two sets are equal, then they are homeomorphic. -/
def set_congr {s t : set α} (h : s = t) : s ≃ₜ t :=
{ continuous_to_fun := continuous_inclusion h.subset,
continuous_inv_fun := continuous_inclusion h.symm.subset,
to_equiv := equiv.set_congr h }
/-- Sum of two homeomorphisms. -/
def sum_congr (h₁ : α ≃ₜ β) (h₂ : γ ≃ₜ δ) : α ⊕ γ ≃ₜ β ⊕ δ :=
{ continuous_to_fun := h₁.continuous.sum_map h₂.continuous,
continuous_inv_fun := h₁.symm.continuous.sum_map h₂.symm.continuous,
to_equiv := h₁.to_equiv.sum_congr h₂.to_equiv }
/-- Product of two homeomorphisms. -/
def prod_congr (h₁ : α ≃ₜ β) (h₂ : γ ≃ₜ δ) : α × γ ≃ₜ β × δ :=
{ continuous_to_fun := (h₁.continuous.comp continuous_fst).prod_mk
(h₂.continuous.comp continuous_snd),
continuous_inv_fun := (h₁.symm.continuous.comp continuous_fst).prod_mk
(h₂.symm.continuous.comp continuous_snd),
to_equiv := h₁.to_equiv.prod_congr h₂.to_equiv }
@[simp] lemma prod_congr_symm (h₁ : α ≃ₜ β) (h₂ : γ ≃ₜ δ) :
(h₁.prod_congr h₂).symm = h₁.symm.prod_congr h₂.symm := rfl
@[simp] lemma coe_prod_congr (h₁ : α ≃ₜ β) (h₂ : γ ≃ₜ δ) :
⇑(h₁.prod_congr h₂) = prod.map h₁ h₂ := rfl
section
variables (α β γ)
/-- `α × β` is homeomorphic to `β × α`. -/
def prod_comm : α × β ≃ₜ β × α :=
{ continuous_to_fun := continuous_snd.prod_mk continuous_fst,
continuous_inv_fun := continuous_snd.prod_mk continuous_fst,
to_equiv := equiv.prod_comm α β }
@[simp] lemma prod_comm_symm : (prod_comm α β).symm = prod_comm β α := rfl
@[simp] lemma coe_prod_comm : ⇑(prod_comm α β) = prod.swap := rfl
/-- `(α × β) × γ` is homeomorphic to `α × (β × γ)`. -/
def prod_assoc : (α × β) × γ ≃ₜ α × (β × γ) :=
{ continuous_to_fun := (continuous_fst.comp continuous_fst).prod_mk
((continuous_snd.comp continuous_fst).prod_mk continuous_snd),
continuous_inv_fun := (continuous_fst.prod_mk (continuous_fst.comp continuous_snd)).prod_mk
(continuous_snd.comp continuous_snd),
to_equiv := equiv.prod_assoc α β γ }
/-- `α × {*}` is homeomorphic to `α`. -/
@[simps apply {fully_applied := ff}]
def prod_punit : α × punit ≃ₜ α :=
{ to_equiv := equiv.prod_punit α,
continuous_to_fun := continuous_fst,
continuous_inv_fun := continuous_id.prod_mk continuous_const }
/-- `{*} × α` is homeomorphic to `α`. -/
def punit_prod : punit × α ≃ₜ α :=
(prod_comm _ _).trans (prod_punit _)
@[simp] lemma coe_punit_prod : ⇑(punit_prod α) = prod.snd := rfl
/-- If both `α` and `β` have a unique element, then `α ≃ₜ β`. -/
@[simps] def _root_.homeomorph.homeomorph_of_unique [unique α] [unique β] : α ≃ₜ β :=
{ continuous_to_fun := @continuous_const α β _ _ default,
continuous_inv_fun := @continuous_const β α _ _ default,
.. equiv.equiv_of_unique α β }
end
/-- If each `β₁ i` is homeomorphic to `β₂ i`, then `Π i, β₁ i` is homeomorphic to `Π i, β₂ i`. -/
@[simps apply to_equiv] def Pi_congr_right {ι : Type*} {β₁ β₂ : ι → Type*}
[Π i, topological_space (β₁ i)] [Π i, topological_space (β₂ i)] (F : Π i, β₁ i ≃ₜ β₂ i) :
(Π i, β₁ i) ≃ₜ (Π i, β₂ i) :=
{ continuous_to_fun := continuous_pi (λ i, (F i).continuous.comp $ continuous_apply i),
continuous_inv_fun := continuous_pi (λ i, (F i).symm.continuous.comp $ continuous_apply i),
to_equiv := equiv.Pi_congr_right (λ i, (F i).to_equiv) }
@[simp] lemma Pi_congr_right_symm {ι : Type*} {β₁ β₂ : ι → Type*} [Π i, topological_space (β₁ i)]
[Π i, topological_space (β₂ i)] (F : Π i, β₁ i ≃ₜ β₂ i) :
(Pi_congr_right F).symm = Pi_congr_right (λ i, (F i).symm) := rfl
/-- `ulift α` is homeomorphic to `α`. -/
def {u v} ulift {α : Type u} [topological_space α] : ulift.{v u} α ≃ₜ α :=
{ continuous_to_fun := continuous_ulift_down,
continuous_inv_fun := continuous_ulift_up,
to_equiv := equiv.ulift }
section distrib
/-- `(α ⊕ β) × γ` is homeomorphic to `α × γ ⊕ β × γ`. -/
def sum_prod_distrib : (α ⊕ β) × γ ≃ₜ α × γ ⊕ β × γ :=
homeomorph.symm $ homeomorph_of_continuous_open (equiv.sum_prod_distrib α β γ).symm
((continuous_inl.prod_map continuous_id).sum_elim (continuous_inr.prod_map continuous_id)) $
(is_open_map_inl.prod is_open_map.id).sum_elim (is_open_map_inr.prod is_open_map.id)
/-- `α × (β ⊕ γ)` is homeomorphic to `α × β ⊕ α × γ`. -/
def prod_sum_distrib : α × (β ⊕ γ) ≃ₜ α × β ⊕ α × γ :=
(prod_comm _ _).trans $
sum_prod_distrib.trans $
sum_congr (prod_comm _ _) (prod_comm _ _)
variables {ι : Type*} {σ : ι → Type*} [Π i, topological_space (σ i)]
/-- `(Σ i, σ i) × β` is homeomorphic to `Σ i, (σ i × β)`. -/
def sigma_prod_distrib : ((Σ i, σ i) × β) ≃ₜ (Σ i, (σ i × β)) :=
homeomorph.symm $ homeomorph_of_continuous_open (equiv.sigma_prod_distrib σ β).symm
(continuous_sigma $ λ i, continuous_sigma_mk.fst'.prod_mk continuous_snd)
(is_open_map_sigma.2 $ λ i, is_open_map_sigma_mk.prod is_open_map.id)
end distrib
/-- If `ι` has a unique element, then `ι → α` is homeomorphic to `α`. -/
@[simps { fully_applied := ff }]
def fun_unique (ι α : Type*) [unique ι] [topological_space α] : (ι → α) ≃ₜ α :=
{ to_equiv := equiv.fun_unique ι α,
continuous_to_fun := continuous_apply _,
continuous_inv_fun := continuous_pi (λ _, continuous_id) }
/-- Homeomorphism between dependent functions `Π i : fin 2, α i` and `α 0 × α 1`. -/
@[simps { fully_applied := ff }]
def {u} pi_fin_two (α : fin 2 → Type u) [Π i, topological_space (α i)] : (Π i, α i) ≃ₜ α 0 × α 1 :=
{ to_equiv := pi_fin_two_equiv α,
continuous_to_fun := (continuous_apply 0).prod_mk (continuous_apply 1),
continuous_inv_fun := continuous_pi $ fin.forall_fin_two.2 ⟨continuous_fst, continuous_snd⟩ }
/-- Homeomorphism between `α² = fin 2 → α` and `α × α`. -/
@[simps { fully_applied := ff }] def fin_two_arrow : (fin 2 → α) ≃ₜ α × α :=
{ to_equiv := fin_two_arrow_equiv α, .. pi_fin_two (λ _, α) }
/--
A subset of a topological space is homeomorphic to its image under a homeomorphism.
-/
@[simps] def image (e : α ≃ₜ β) (s : set α) : s ≃ₜ e '' s :=
{ continuous_to_fun := by continuity!,
continuous_inv_fun := by continuity!,
to_equiv := e.to_equiv.image s, }
/-- `set.univ α` is homeomorphic to `α`. -/
@[simps { fully_applied := ff }]
def set.univ (α : Type*) [topological_space α] : (univ : set α) ≃ₜ α :=
{ to_equiv := equiv.set.univ α,
continuous_to_fun := continuous_subtype_coe,
continuous_inv_fun := continuous_id.subtype_mk _ }
/-- `s ×ˢ t` is homeomorphic to `s × t`. -/
@[simps] def set.prod (s : set α) (t : set β) : ↥(s ×ˢ t) ≃ₜ s × t :=
{ to_equiv := equiv.set.prod s t,
continuous_to_fun := (continuous_subtype_coe.fst.subtype_mk _).prod_mk
(continuous_subtype_coe.snd.subtype_mk _),
continuous_inv_fun := (continuous_subtype_coe.fst'.prod_mk
continuous_subtype_coe.snd').subtype_mk _ }
section
variable {ι : Type*}
/-- The topological space `Π i, β i` can be split as a product by separating the indices in ι
depending on whether they satisfy a predicate p or not.-/
@[simps] def pi_equiv_pi_subtype_prod (p : ι → Prop) (β : ι → Type*) [Π i, topological_space (β i)]
[decidable_pred p] : (Π i, β i) ≃ₜ (Π i : {x // p x}, β i) × Π i : {x // ¬p x}, β i :=
{ to_equiv := equiv.pi_equiv_pi_subtype_prod p β,
continuous_to_fun := by apply continuous.prod_mk; exact continuous_pi (λ j, continuous_apply j),
continuous_inv_fun := continuous_pi $ λ j, begin
dsimp only [equiv.pi_equiv_pi_subtype_prod], split_ifs,
exacts [(continuous_apply _).comp continuous_fst, (continuous_apply _).comp continuous_snd],
end }
variables [decidable_eq ι] (i : ι)
/-- A product of topological spaces can be split as the binary product of one of the spaces and
the product of all the remaining spaces. -/
@[simps] def pi_split_at (β : ι → Type*) [Π j, topological_space (β j)] :
(Π j, β j) ≃ₜ β i × Π j : {j // j ≠ i}, β j :=
{ to_equiv := equiv.pi_split_at i β,
continuous_to_fun := (continuous_apply i).prod_mk (continuous_pi $ λ j, continuous_apply j),
continuous_inv_fun := continuous_pi $ λ j, by { dsimp only [equiv.pi_split_at],
split_ifs, subst h, exacts [continuous_fst, (continuous_apply _).comp continuous_snd] } }
/-- A product of copies of a topological space can be split as the binary product of one copy and
the product of all the remaining copies. -/
@[simps] def fun_split_at : (ι → β) ≃ₜ β × ({j // j ≠ i} → β) := pi_split_at i _
end
end homeomorph
/-- An inducing equiv between topological spaces is a homeomorphism. -/
@[simps] def equiv.to_homeomorph_of_inducing [topological_space α] [topological_space β] (f : α ≃ β)
(hf : inducing f) :
α ≃ₜ β :=
{ continuous_to_fun := hf.continuous,
continuous_inv_fun := hf.continuous_iff.2 $ by simpa using continuous_id,
.. f }
namespace continuous
variables [topological_space α] [topological_space β]
lemma continuous_symm_of_equiv_compact_to_t2 [compact_space α] [t2_space β]
{f : α ≃ β} (hf : continuous f) : continuous f.symm :=
begin
rw continuous_iff_is_closed,
intros C hC,
have hC' : is_closed (f '' C) := (hC.is_compact.image hf).is_closed,
rwa equiv.image_eq_preimage at hC',
end
/-- Continuous equivalences from a compact space to a T2 space are homeomorphisms.
This is not true when T2 is weakened to T1
(see `continuous.homeo_of_equiv_compact_to_t2.t1_counterexample`). -/
@[simps]
def homeo_of_equiv_compact_to_t2 [compact_space α] [t2_space β]
{f : α ≃ β} (hf : continuous f) : α ≃ₜ β :=
{ continuous_to_fun := hf,
continuous_inv_fun := hf.continuous_symm_of_equiv_compact_to_t2,
..f }
end continuous
|
module Test.Vec
import Test.Assertions
import Idrlisp.Vec
%default covering
export
test : IO ()
test = describe "Idrlisp.Vec" $ do
describe "empty, new, fromList, toList" $ do
Vec.toList (the (Vec ()) Vec.empty)
`shouldBe'` []
vec <- Vec.new 3 "foo"
Vec.toList vec
`shouldBe'` ["foo", "foo", "foo"]
vec <- Vec.fromList (the (List ()) [])
Vec.toList vec
`shouldBe'` []
vec <- Vec.fromList ["a", "b", "c"]
Vec.toList vec
`shouldBe'` ["a", "b", "c"]
describe "length" $ do
Vec.length (the (Vec ()) Vec.empty)
`shouldBe` 0
vec <- Vec.new 3 "foo"
Vec.length vec
`shouldBe` 3
describe "read" $ do
vec <- Vec.fromList ["a", "b", "c"]
Vec.read 0 vec
`shouldBe'` Just "a"
Vec.read 1 vec
`shouldBe'` Just "b"
Vec.read 2 vec
`shouldBe'` Just "c"
Vec.read 3 vec
`shouldBe'` Nothing
describe "write" $ do
vec <- Vec.fromList ["a", "b", "c"]
Vec.write 0 "x" vec
`shouldBe'` True
Vec.write 2 "y" vec
`shouldBe'` True
Vec.write 4 "z" vec
`shouldBe'` False
Vec.toList vec
`shouldBe'` ["x", "b", "y"]
describe "copy" $ do
src <- Vec.fromList ["a", "b", "c", "d"]
dest <- Vec.fromList ["1", "2", "3", "4", "5"]
Vec.copy src 1 dest 2 3
`shouldBe'` True
Vec.toList src
`shouldBe'` ["a", "b", "c", "d"]
Vec.toList dest
`shouldBe'` ["1", "2", "b", "c", "d"]
|
Emergency situations at petrol filling stations are not so uncommon. And for that reason, motorists need to maintain their situational awareness using Think 6, Look 6 whenever they stop to refuel.
Below are just four recent examples of fires, explosions or spills which occurred at gasoline stations over the last few weeks. These nicely make the point that drivers need to be ever-vigilent for danger - particularly where hazardous substances are present.
+ The first example occured on August 19 at a petrol station in St. Augustine, Florida. A tanker truck was delivering 8,800 gallons of gasoline, when fuel overflowed and spilled to the ground before exploding. The driver of the tanker truck was seriously burned.
+ The second example happened on the 1st October when a fire broke out at the BP Garage on the A120 in Bradwell (UK) and completely destroyed the petrol station.
+ The third example occurred when a man fleeing from police crashed into a Chevron Petrol Station in Davie, Florida on 6th October. The crash led to an explosion which destroyed petrol pumps and three vehicles.
+ And in the most recent example, a driver cashed her car into a Route 18 gas station in Bridgewater (MA), severing the pump and causing a small amount of gas to spew from the ground. According to local police, the driver lost control of her vehicle because of wet conditions.
The National Academy of Engineering and the US National Research Council have released the interim report of the Committee on the Analysis of Causes of the Deepwater Horizon Explosion, Fire and Oil Spill.
The report includes preliminary findings and observations on various actions and decisions including well design, cementing operations, well monitoring and control actions, management oversight and general regulation.
The interim report is available by clicking here.
The commitee's final report is due for publication in June 2011. |
lemma closure_contains_Sup: fixes S :: "real set" assumes "S \<noteq> {}" "bdd_above S" shows "Sup S \<in> closure S" |
[STATEMENT]
lemma "wellformed_items (Init)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. wellformed_items Init
[PROOF STEP]
by (auto simp add: wellformed_items_def Init_def init_item_def wellformed_item_def) |
/-
Copyright (c) 2019 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison, Markus Himmel
-/
import category_theory.limits.shapes.equalizers
import category_theory.limits.shapes.pullbacks
import category_theory.limits.shapes.strong_epi
/-!
# Categorical images
> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
> Any changes to this file require a corresponding PR to mathlib4.
We define the categorical image of `f` as a factorisation `f = e ≫ m` through a monomorphism `m`,
so that `m` factors through the `m'` in any other such factorisation.
## Main definitions
* A `mono_factorisation` is a factorisation `f = e ≫ m`, where `m` is a monomorphism
* `is_image F` means that a given mono factorisation `F` has the universal property of the image.
* `has_image f` means that there is some image factorization for the morphism `f : X ⟶ Y`.
* In this case, `image f` is some image object (selected with choice), `image.ι f : image f ⟶ Y`
is the monomorphism `m` of the factorisation and `factor_thru_image f : X ⟶ image f` is the
morphism `e`.
* `has_images C` means that every morphism in `C` has an image.
* Let `f : X ⟶ Y` and `g : P ⟶ Q` be morphisms in `C`, which we will represent as objects of the
arrow category `arrow C`. Then `sq : f ⟶ g` is a commutative square in `C`. If `f` and `g` have
images, then `has_image_map sq` represents the fact that there is a morphism
`i : image f ⟶ image g` making the diagram
X ----→ image f ----→ Y
| | |
| | |
↓ ↓ ↓
P ----→ image g ----→ Q
commute, where the top row is the image factorisation of `f`, the bottom row is the image
factorisation of `g`, and the outer rectangle is the commutative square `sq`.
* If a category `has_images`, then `has_image_maps` means that every commutative square admits an
image map.
* If a category `has_images`, then `has_strong_epi_images` means that the morphism to the image is
always a strong epimorphism.
## Main statements
* When `C` has equalizers, the morphism `e` appearing in an image factorisation is an epimorphism.
* When `C` has strong epi images, then these images admit image maps.
## Future work
* TODO: coimages, and abelian categories.
* TODO: connect this with existing working in the group theory and ring theory libraries.
-/
noncomputable theory
universes v u
open category_theory
open category_theory.limits.walking_parallel_pair
namespace category_theory.limits
variables {C : Type u} [category.{v} C]
variables {X Y : C} (f : X ⟶ Y)
/-- A factorisation of a morphism `f = e ≫ m`, with `m` monic. -/
structure mono_factorisation (f : X ⟶ Y) :=
(I : C)
(m : I ⟶ Y)
[m_mono : mono m]
(e : X ⟶ I)
(fac' : e ≫ m = f . obviously)
restate_axiom mono_factorisation.fac'
attribute [simp, reassoc] mono_factorisation.fac
attribute [instance] mono_factorisation.m_mono
attribute [instance] mono_factorisation.m_mono
namespace mono_factorisation
/-- The obvious factorisation of a monomorphism through itself. -/
def self [mono f] : mono_factorisation f :=
{ I := X,
m := f,
e := 𝟙 X }
-- I'm not sure we really need this, but the linter says that an inhabited instance
-- ought to exist...
instance [mono f] : inhabited (mono_factorisation f) := ⟨self f⟩
variables {f}
/-- The morphism `m` in a factorisation `f = e ≫ m` through a monomorphism is uniquely
determined. -/
@[ext]
lemma ext
{F F' : mono_factorisation f} (hI : F.I = F'.I) (hm : F.m = (eq_to_hom hI) ≫ F'.m) : F = F' :=
begin
cases F, cases F',
cases hI,
simp at hm,
dsimp at F_fac' F'_fac',
congr,
{ assumption },
{ resetI, apply (cancel_mono F_m).1,
rw [F_fac', hm, F'_fac'], }
end
/-- Any mono factorisation of `f` gives a mono factorisation of `f ≫ g` when `g` is a mono. -/
@[simps]
def comp_mono (F : mono_factorisation f) {Y' : C} (g : Y ⟶ Y') [mono g] :
mono_factorisation (f ≫ g) :=
{ I := F.I,
m := F.m ≫ g,
m_mono := mono_comp _ _,
e := F.e, }
/-- A mono factorisation of `f ≫ g`, where `g` is an isomorphism,
gives a mono factorisation of `f`. -/
@[simps]
def of_comp_iso {Y' : C} {g : Y ⟶ Y'} [is_iso g] (F : mono_factorisation (f ≫ g)) :
mono_factorisation f :=
{ I := F.I,
m := F.m ≫ (inv g),
m_mono := mono_comp _ _,
e := F.e, }
/-- Any mono factorisation of `f` gives a mono factorisation of `g ≫ f`. -/
@[simps]
def iso_comp (F : mono_factorisation f) {X' : C} (g : X' ⟶ X) :
mono_factorisation (g ≫ f) :=
{ I := F.I,
m := F.m,
e := g ≫ F.e, }
/-- A mono factorisation of `g ≫ f`, where `g` is an isomorphism,
gives a mono factorisation of `f`. -/
@[simps]
def of_iso_comp {X' : C} (g : X' ⟶ X) [is_iso g] (F : mono_factorisation (g ≫ f)) :
mono_factorisation f :=
{ I := F.I,
m := F.m,
e := inv g ≫ F.e, }
/-- If `f` and `g` are isomorphic arrows, then a mono factorisation of `f`
gives a mono factorisation of `g` -/
@[simps]
def of_arrow_iso {f g : arrow C} (F : mono_factorisation f.hom) (sq : f ⟶ g) [is_iso sq] :
mono_factorisation g.hom :=
{ I := F.I,
m := F.m ≫ sq.right,
e := inv sq.left ≫ F.e,
m_mono := mono_comp _ _,
fac' := by simp only [fac_assoc, arrow.w, is_iso.inv_comp_eq, category.assoc] }
end mono_factorisation
variable {f}
/-- Data exhibiting that a given factorisation through a mono is initial. -/
structure is_image (F : mono_factorisation f) :=
(lift : Π (F' : mono_factorisation f), F.I ⟶ F'.I)
(lift_fac' : Π (F' : mono_factorisation f), lift F' ≫ F'.m = F.m . obviously)
restate_axiom is_image.lift_fac'
attribute [simp, reassoc] is_image.lift_fac
namespace is_image
@[simp, reassoc] lemma fac_lift {F : mono_factorisation f} (hF : is_image F)
(F' : mono_factorisation f) : F.e ≫ hF.lift F' = F'.e :=
(cancel_mono F'.m).1 $ by simp
variable (f)
/-- The trivial factorisation of a monomorphism satisfies the universal property. -/
@[simps]
def self [mono f] : is_image (mono_factorisation.self f) :=
{ lift := λ F', F'.e }
instance [mono f] : inhabited (is_image (mono_factorisation.self f)) :=
⟨self f⟩
variable {f}
/-- Two factorisations through monomorphisms satisfying the universal property
must factor through isomorphic objects. -/
-- TODO this is another good candidate for a future `unique_up_to_canonical_iso`.
@[simps]
def iso_ext {F F' : mono_factorisation f} (hF : is_image F) (hF' : is_image F') : F.I ≅ F'.I :=
{ hom := hF.lift F',
inv := hF'.lift F,
hom_inv_id' := (cancel_mono F.m).1 (by simp),
inv_hom_id' := (cancel_mono F'.m).1 (by simp) }
variables {F F' : mono_factorisation f} (hF : is_image F) (hF' : is_image F')
lemma iso_ext_hom_m : (iso_ext hF hF').hom ≫ F'.m = F.m := by simp
lemma iso_ext_inv_m : (iso_ext hF hF').inv ≫ F.m = F'.m := by simp
lemma e_iso_ext_hom : F.e ≫ (iso_ext hF hF').hom = F'.e := by simp
lemma e_iso_ext_inv : F'.e ≫ (iso_ext hF hF').inv = F.e := by simp
/-- If `f` and `g` are isomorphic arrows, then a mono factorisation of `f` that is an image
gives a mono factorisation of `g` that is an image -/
@[simps]
def of_arrow_iso {f g : arrow C} {F : mono_factorisation f.hom} (hF : is_image F)
(sq : f ⟶ g) [is_iso sq] :
is_image (F.of_arrow_iso sq) :=
{ lift := λ F', hF.lift (F'.of_arrow_iso (inv sq)),
lift_fac' := λ F', by simpa only [mono_factorisation.of_arrow_iso_m, arrow.inv_right,
← category.assoc, is_iso.comp_inv_eq] using hF.lift_fac (F'.of_arrow_iso (inv sq)) }
end is_image
variable (f)
/-- Data exhibiting that a morphism `f` has an image. -/
structure image_factorisation (f : X ⟶ Y) :=
(F : mono_factorisation f)
(is_image : is_image F)
namespace image_factorisation
instance [mono f] : inhabited (image_factorisation f) :=
⟨⟨_, is_image.self f⟩⟩
/-- If `f` and `g` are isomorphic arrows, then an image factorisation of `f`
gives an image factorisation of `g` -/
@[simps]
def of_arrow_iso {f g : arrow C} (F : image_factorisation f.hom) (sq : f ⟶ g) [is_iso sq] :
image_factorisation g.hom :=
{ F := F.F.of_arrow_iso sq,
is_image := F.is_image.of_arrow_iso sq }
end image_factorisation
/-- `has_image f` means that there exists an image factorisation of `f`. -/
class has_image (f : X ⟶ Y) : Prop :=
mk' :: (exists_image : nonempty (image_factorisation f))
lemma has_image.mk {f : X ⟶ Y} (F : image_factorisation f) : has_image f :=
⟨nonempty.intro F⟩
lemma has_image.of_arrow_iso {f g : arrow C} [h : has_image f.hom] (sq : f ⟶ g) [is_iso sq] :
has_image g.hom :=
⟨⟨h.exists_image.some.of_arrow_iso sq⟩⟩
@[priority 100]
instance mono_has_image (f : X ⟶ Y) [mono f] : has_image f :=
has_image.mk ⟨_, is_image.self f⟩
section
variable [has_image f]
/-- Some factorisation of `f` through a monomorphism (selected with choice). -/
def image.mono_factorisation : mono_factorisation f :=
(classical.choice (has_image.exists_image)).F
/-- The witness of the universal property for the chosen factorisation of `f` through
a monomorphism. -/
def image.is_image : is_image (image.mono_factorisation f) :=
(classical.choice (has_image.exists_image)).is_image
/-- The categorical image of a morphism. -/
def image : C := (image.mono_factorisation f).I
/-- The inclusion of the image of a morphism into the target. -/
def image.ι : image f ⟶ Y := (image.mono_factorisation f).m
@[simp] lemma image.as_ι : (image.mono_factorisation f).m = image.ι f := rfl
instance : mono (image.ι f) := (image.mono_factorisation f).m_mono
/-- The map from the source to the image of a morphism. -/
def factor_thru_image : X ⟶ image f := (image.mono_factorisation f).e
/-- Rewrite in terms of the `factor_thru_image` interface. -/
@[simp]
lemma as_factor_thru_image : (image.mono_factorisation f).e = factor_thru_image f := rfl
@[simp, reassoc]
lemma image.fac : factor_thru_image f ≫ image.ι f = f := (image.mono_factorisation f).fac'
variable {f}
/-- Any other factorisation of the morphism `f` through a monomorphism receives a map from the
image. -/
def image.lift (F' : mono_factorisation f) : image f ⟶ F'.I := (image.is_image f).lift F'
@[simp, reassoc]
lemma image.lift_fac (F' : mono_factorisation f) : image.lift F' ≫ F'.m = image.ι f :=
(image.is_image f).lift_fac' F'
@[simp, reassoc]
lemma image.fac_lift (F' : mono_factorisation f) : factor_thru_image f ≫ image.lift F' = F'.e :=
(image.is_image f).fac_lift F'
@[simp]
lemma image.is_image_lift (F : mono_factorisation f) :
(image.is_image f).lift F = image.lift F :=
rfl
@[simp, reassoc]
lemma is_image.lift_ι {F : mono_factorisation f} (hF : is_image F) :
hF.lift (image.mono_factorisation f) ≫ image.ι f = F.m :=
hF.lift_fac _
-- TODO we could put a category structure on `mono_factorisation f`,
-- with the morphisms being `g : I ⟶ I'` commuting with the `m`s
-- (they then automatically commute with the `e`s)
-- and show that an `image_of f` gives an initial object there
-- (uniqueness of the lift comes for free).
instance image.lift_mono (F' : mono_factorisation f) : mono (image.lift F') :=
by { apply mono_of_mono _ F'.m, simpa using mono_factorisation.m_mono _ }
lemma has_image.uniq
(F' : mono_factorisation f) (l : image f ⟶ F'.I) (w : l ≫ F'.m = image.ι f) :
l = image.lift F' :=
(cancel_mono F'.m).1 (by simp [w])
/-- If `has_image g`, then `has_image (f ≫ g)` when `f` is an isomorphism. -/
instance {X Y Z : C} (f : X ⟶ Y) [is_iso f] (g : Y ⟶ Z) [has_image g] : has_image (f ≫ g) :=
{ exists_image := ⟨
{ F :=
{ I := image g,
m := image.ι g,
e := f ≫ factor_thru_image g, },
is_image := { lift := λ F', image.lift { I := F'.I, m := F'.m, e := inv f ≫ F'.e, }, }, }⟩ }
end
section
variables (C)
/-- `has_images` asserts that every morphism has an image. -/
class has_images : Prop :=
(has_image : Π {X Y : C} (f : X ⟶ Y), has_image f)
attribute [instance, priority 100] has_images.has_image
end
section
variables (f)
/-- The image of a monomorphism is isomorphic to the source. -/
def image_mono_iso_source [mono f] : image f ≅ X :=
is_image.iso_ext (image.is_image f) (is_image.self f)
@[simp, reassoc]
lemma image_mono_iso_source_inv_ι [mono f] : (image_mono_iso_source f).inv ≫ image.ι f = f :=
by simp [image_mono_iso_source]
@[simp, reassoc]
lemma image_mono_iso_source_hom_self [mono f] : (image_mono_iso_source f).hom ≫ f = image.ι f :=
begin
conv { to_lhs, congr, skip, rw ←image_mono_iso_source_inv_ι f, },
rw [←category.assoc, iso.hom_inv_id, category.id_comp],
end
-- This is the proof that `factor_thru_image f` is an epimorphism
-- from https://en.wikipedia.org/wiki/Image_%28category_theory%29, which is in turn taken from:
-- Mitchell, Barry (1965), Theory of categories, MR 0202787, p.12, Proposition 10.1
@[ext]
lemma image.ext [has_image f] {W : C} {g h : image f ⟶ W} [has_limit (parallel_pair g h)]
(w : factor_thru_image f ≫ g = factor_thru_image f ≫ h) :
g = h :=
begin
let q := equalizer.ι g h,
let e' := equalizer.lift _ w,
let F' : mono_factorisation f :=
{ I := equalizer g h,
m := q ≫ image.ι f,
m_mono := by apply mono_comp,
e := e' },
let v := image.lift F',
have t₀ : v ≫ q ≫ image.ι f = image.ι f := image.lift_fac F',
have t : v ≫ q = 𝟙 (image f) :=
(cancel_mono_id (image.ι f)).1 (by { convert t₀ using 1, rw category.assoc }),
-- The proof from wikipedia next proves `q ≫ v = 𝟙 _`,
-- and concludes that `equalizer g h ≅ image f`,
-- but this isn't necessary.
calc g = 𝟙 (image f) ≫ g : by rw [category.id_comp]
... = v ≫ q ≫ g : by rw [←t, category.assoc]
... = v ≫ q ≫ h : by rw [equalizer.condition g h]
... = 𝟙 (image f) ≫ h : by rw [←category.assoc, t]
... = h : by rw [category.id_comp]
end
instance [has_image f] [Π {Z : C} (g h : image f ⟶ Z), has_limit (parallel_pair g h)] :
epi (factor_thru_image f) :=
⟨λ Z g h w, image.ext f w⟩
lemma epi_image_of_epi {X Y : C} (f : X ⟶ Y) [has_image f] [E : epi f] : epi (image.ι f) :=
begin
rw ←image.fac f at E,
resetI,
exact epi_of_epi (factor_thru_image f) (image.ι f),
end
lemma epi_of_epi_image {X Y : C} (f : X ⟶ Y) [has_image f]
[epi (image.ι f)] [epi (factor_thru_image f)] : epi f :=
by { rw [←image.fac f], apply epi_comp, }
end
section
variables {f} {f' : X ⟶ Y} [has_image f] [has_image f']
/--
An equation between morphisms gives a comparison map between the images
(which momentarily we prove is an iso).
-/
def image.eq_to_hom (h : f = f') : image f ⟶ image f' :=
image.lift
{ I := image f',
m := image.ι f',
e := factor_thru_image f', }.
instance (h : f = f') : is_iso (image.eq_to_hom h) :=
⟨⟨image.eq_to_hom h.symm,
⟨(cancel_mono (image.ι f)).1 (by simp [image.eq_to_hom]),
(cancel_mono (image.ι f')).1 (by simp [image.eq_to_hom])⟩⟩⟩
/-- An equation between morphisms gives an isomorphism between the images. -/
def image.eq_to_iso (h : f = f') : image f ≅ image f' := as_iso (image.eq_to_hom h)
/--
As long as the category has equalizers,
the image inclusion maps commute with `image.eq_to_iso`.
-/
lemma image.eq_fac [has_equalizers C] (h : f = f') :
image.ι f = (image.eq_to_iso h).hom ≫ image.ι f' :=
by { ext, simp [image.eq_to_iso, image.eq_to_hom], }
end
section
variables {Z : C} (g : Y ⟶ Z)
/-- The comparison map `image (f ≫ g) ⟶ image g`. -/
def image.pre_comp [has_image g] [has_image (f ≫ g)] : image (f ≫ g) ⟶ image g :=
image.lift
{ I := image g,
m := image.ι g,
e := f ≫ factor_thru_image g }
@[simp, reassoc]
lemma image.pre_comp_ι [has_image g] [has_image (f ≫ g)] :
image.pre_comp f g ≫ image.ι g = image.ι (f ≫ g) :=
by simp [image.pre_comp]
@[simp, reassoc]
lemma image.factor_thru_image_pre_comp [has_image g] [has_image (f ≫ g)] :
factor_thru_image (f ≫ g) ≫ image.pre_comp f g = f ≫ factor_thru_image g :=
by simp [image.pre_comp]
/--
`image.pre_comp f g` is a monomorphism.
-/
instance image.pre_comp_mono [has_image g] [has_image (f ≫ g)] : mono (image.pre_comp f g) :=
begin
apply mono_of_mono _ (image.ι g),
simp only [image.pre_comp_ι],
apply_instance,
end
/--
The two step comparison map
`image (f ≫ (g ≫ h)) ⟶ image (g ≫ h) ⟶ image h`
agrees with the one step comparison map
`image (f ≫ (g ≫ h)) ≅ image ((f ≫ g) ≫ h) ⟶ image h`.
-/
lemma image.pre_comp_comp {W : C} (h : Z ⟶ W)
[has_image (g ≫ h)] [has_image (f ≫ g ≫ h)]
[has_image h] [has_image ((f ≫ g) ≫ h)] :
image.pre_comp f (g ≫ h) ≫ image.pre_comp g h =
image.eq_to_hom (category.assoc f g h).symm ≫ (image.pre_comp (f ≫ g) h) :=
begin
apply (cancel_mono (image.ι h)).1,
simp [image.pre_comp, image.eq_to_hom],
end
variables [has_equalizers C]
/--
`image.pre_comp f g` is an epimorphism when `f` is an epimorphism
(we need `C` to have equalizers to prove this).
-/
instance image.pre_comp_epi_of_epi [has_image g] [has_image (f ≫ g)] [epi f] :
epi (image.pre_comp f g) :=
begin
apply epi_of_epi_fac (image.factor_thru_image_pre_comp _ _),
exact epi_comp _ _
end
instance has_image_iso_comp [is_iso f] [has_image g] : has_image (f ≫ g) :=
has_image.mk
{ F := (image.mono_factorisation g).iso_comp f,
is_image := { lift := λ F', image.lift (F'.of_iso_comp f) }, }
/--
`image.pre_comp f g` is an isomorphism when `f` is an isomorphism
(we need `C` to have equalizers to prove this).
-/
instance image.is_iso_precomp_iso (f : X ⟶ Y) [is_iso f] [has_image g] :
is_iso (image.pre_comp f g) :=
⟨⟨image.lift
{ I := image (f ≫ g),
m := image.ι (f ≫ g),
e := inv f ≫ factor_thru_image (f ≫ g) },
⟨by { ext, simp [image.pre_comp], }, by { ext, simp [image.pre_comp], }⟩⟩⟩
-- Note that in general we don't have the other comparison map you might expect
-- `image f ⟶ image (f ≫ g)`.
instance has_image_comp_iso [has_image f] [is_iso g] : has_image (f ≫ g) :=
has_image.mk
{ F := (image.mono_factorisation f).comp_mono g,
is_image := { lift := λ F', image.lift F'.of_comp_iso }, }
/-- Postcomposing by an isomorphism induces an isomorphism on the image. -/
def image.comp_iso [has_image f] [is_iso g] :
image f ≅ image (f ≫ g) :=
{ hom := image.lift (image.mono_factorisation (f ≫ g)).of_comp_iso,
inv := image.lift ((image.mono_factorisation f).comp_mono g) }
@[simp, reassoc] lemma image.comp_iso_hom_comp_image_ι [has_image f] [is_iso g] :
(image.comp_iso f g).hom ≫ image.ι (f ≫ g) = image.ι f ≫ g :=
by { ext, simp [image.comp_iso] }
@[simp, reassoc] lemma image.comp_iso_inv_comp_image_ι [has_image f] [is_iso g] :
(image.comp_iso f g).inv ≫ image.ι f = image.ι (f ≫ g) ≫ inv g :=
by { ext, simp [image.comp_iso] }
end
end category_theory.limits
namespace category_theory.limits
variables {C : Type u} [category.{v} C]
section
instance {X Y : C} (f : X ⟶ Y) [has_image f] : has_image (arrow.mk f).hom :=
show has_image f, by apply_instance
end
section has_image_map
/-- An image map is a morphism `image f → image g` fitting into a commutative square and satisfying
the obvious commutativity conditions. -/
structure image_map {f g : arrow C} [has_image f.hom] [has_image g.hom] (sq : f ⟶ g) :=
(map : image f.hom ⟶ image g.hom)
(map_ι' : map ≫ image.ι g.hom = image.ι f.hom ≫ sq.right . obviously)
instance inhabited_image_map {f : arrow C} [has_image f.hom] : inhabited (image_map (𝟙 f)) :=
⟨⟨𝟙 _, by tidy⟩⟩
restate_axiom image_map.map_ι'
attribute [simp, reassoc] image_map.map_ι
@[simp, reassoc]
lemma image_map.factor_map {f g : arrow C} [has_image f.hom] [has_image g.hom] (sq : f ⟶ g)
(m : image_map sq) :
factor_thru_image f.hom ≫ m.map = sq.left ≫ factor_thru_image g.hom :=
(cancel_mono (image.ι g.hom)).1 $ by simp
/-- To give an image map for a commutative square with `f` at the top and `g` at the bottom, it
suffices to give a map between any mono factorisation of `f` and any image factorisation of
`g`. -/
def image_map.transport {f g : arrow C} [has_image f.hom] [has_image g.hom] (sq : f ⟶ g)
(F : mono_factorisation f.hom) {F' : mono_factorisation g.hom} (hF' : is_image F')
{map : F.I ⟶ F'.I} (map_ι : map ≫ F'.m = F.m ≫ sq.right) : image_map sq :=
{ map := image.lift F ≫ map ≫ hF'.lift (image.mono_factorisation g.hom),
map_ι' := by simp [map_ι] }
/-- `has_image_map sq` means that there is an `image_map` for the square `sq`. -/
class has_image_map {f g : arrow C} [has_image f.hom] [has_image g.hom] (sq : f ⟶ g) : Prop :=
mk' :: (has_image_map : nonempty (image_map sq))
lemma has_image_map.mk {f g : arrow C} [has_image f.hom] [has_image g.hom] {sq : f ⟶ g}
(m : image_map sq) : has_image_map sq :=
⟨nonempty.intro m⟩
lemma has_image_map.transport {f g : arrow C} [has_image f.hom] [has_image g.hom] (sq : f ⟶ g)
(F : mono_factorisation f.hom) {F' : mono_factorisation g.hom} (hF' : is_image F')
(map : F.I ⟶ F'.I) (map_ι : map ≫ F'.m = F.m ≫ sq.right) : has_image_map sq :=
has_image_map.mk $ image_map.transport sq F hF' map_ι
/-- Obtain an `image_map` from a `has_image_map` instance. -/
def has_image_map.image_map {f g : arrow C} [has_image f.hom] [has_image g.hom] (sq : f ⟶ g)
[has_image_map sq] : image_map sq :=
classical.choice $ @has_image_map.has_image_map _ _ _ _ _ _ sq _
@[priority 100] -- see Note [lower instance priority]
instance has_image_map_of_is_iso {f g : arrow C} [has_image f.hom] [has_image g.hom]
(sq : f ⟶ g) [is_iso sq] :
has_image_map sq :=
has_image_map.mk
{ map := image.lift ((image.mono_factorisation g.hom).of_arrow_iso (inv sq)),
map_ι' := begin
erw [← cancel_mono (inv sq).right, category.assoc, ← mono_factorisation.of_arrow_iso_m,
image.lift_fac, category.assoc, ← comma.comp_right, is_iso.hom_inv_id,
comma.id_right, category.comp_id],
end }
instance has_image_map.comp {f g h : arrow C} [has_image f.hom] [has_image g.hom] [has_image h.hom]
(sq1 : f ⟶ g) (sq2 : g ⟶ h) [has_image_map sq1] [has_image_map sq2] :
has_image_map (sq1 ≫ sq2) :=
has_image_map.mk
{ map := (has_image_map.image_map sq1).map ≫ (has_image_map.image_map sq2).map,
map_ι' :=
by simp only [image_map.map_ι, image_map.map_ι_assoc, comma.comp_right, category.assoc] }
variables {f g : arrow C} [has_image f.hom] [has_image g.hom] (sq : f ⟶ g)
section
local attribute [ext] image_map
instance : subsingleton (image_map sq) :=
subsingleton.intro $ λ a b, image_map.ext a b $ (cancel_mono (image.ι g.hom)).1 $
by simp only [image_map.map_ι]
end
variable [has_image_map sq]
/-- The map on images induced by a commutative square. -/
abbreviation image.map : image f.hom ⟶ image g.hom :=
(has_image_map.image_map sq).map
lemma image.factor_map :
factor_thru_image f.hom ≫ image.map sq = sq.left ≫ factor_thru_image g.hom :=
by simp
lemma image.map_ι : image.map sq ≫ image.ι g.hom = image.ι f.hom ≫ sq.right :=
by simp
lemma image.map_hom_mk'_ι {X Y P Q : C} {k : X ⟶ Y} [has_image k] {l : P ⟶ Q} [has_image l]
{m : X ⟶ P} {n : Y ⟶ Q} (w : m ≫ l = k ≫ n) [has_image_map (arrow.hom_mk' w)] :
image.map (arrow.hom_mk' w) ≫ image.ι l = image.ι k ≫ n :=
image.map_ι _
section
variables {h : arrow C} [has_image h.hom] (sq' : g ⟶ h)
variables [has_image_map sq']
/-- Image maps for composable commutative squares induce an image map in the composite square. -/
def image_map_comp : image_map (sq ≫ sq') :=
{ map := image.map sq ≫ image.map sq' }
@[simp]
lemma image.map_comp [has_image_map (sq ≫ sq')] :
image.map (sq ≫ sq') = image.map sq ≫ image.map sq' :=
show (has_image_map.image_map (sq ≫ sq')).map = (image_map_comp sq sq').map, by congr
end
section
variables (f)
/-- The identity `image f ⟶ image f` fits into the commutative square represented by the identity
morphism `𝟙 f` in the arrow category. -/
def image_map_id : image_map (𝟙 f) :=
{ map := 𝟙 (image f.hom) }
@[simp]
lemma image.map_id [has_image_map (𝟙 f)] : image.map (𝟙 f) = 𝟙 (image f.hom) :=
show (has_image_map.image_map (𝟙 f)).map = (image_map_id f).map, by congr
end
end has_image_map
section
variables (C) [has_images C]
/-- If a category `has_image_maps`, then all commutative squares induce morphisms on images. -/
class has_image_maps :=
(has_image_map : Π {f g : arrow C} (st : f ⟶ g), has_image_map st)
attribute [instance, priority 100] has_image_maps.has_image_map
end
section has_image_maps
variables [has_images C] [has_image_maps C]
/-- The functor from the arrow category of `C` to `C` itself that maps a morphism to its image
and a commutative square to the induced morphism on images. -/
@[simps]
def im : arrow C ⥤ C :=
{ obj := λ f, image f.hom,
map := λ _ _ st, image.map st }
end has_image_maps
section strong_epi_mono_factorisation
/-- A strong epi-mono factorisation is a decomposition `f = e ≫ m` with `e` a strong epimorphism
and `m` a monomorphism. -/
structure strong_epi_mono_factorisation {X Y : C} (f : X ⟶ Y) extends mono_factorisation f :=
[e_strong_epi : strong_epi e]
attribute [instance] strong_epi_mono_factorisation.e_strong_epi
/-- Satisfying the inhabited linter -/
instance strong_epi_mono_factorisation_inhabited {X Y : C} (f : X ⟶ Y) [strong_epi f] :
inhabited (strong_epi_mono_factorisation f) :=
⟨⟨⟨Y, 𝟙 Y, f, by simp⟩⟩⟩
/-- A mono factorisation coming from a strong epi-mono factorisation always has the universal
property of the image. -/
def strong_epi_mono_factorisation.to_mono_is_image {X Y : C} {f : X ⟶ Y}
(F : strong_epi_mono_factorisation f) : is_image F.to_mono_factorisation :=
{ lift := λ G, (comm_sq.mk (show G.e ≫ G.m = F.e ≫ F.m,
by rw [F.to_mono_factorisation.fac, G.fac])).lift, }
variable (C)
/-- A category has strong epi-mono factorisations if every morphism admits a strong epi-mono
factorisation. -/
class has_strong_epi_mono_factorisations : Prop :=
mk' :: (has_fac : Π {X Y : C} (f : X ⟶ Y), nonempty (strong_epi_mono_factorisation f))
variable {C}
lemma has_strong_epi_mono_factorisations.mk
(d : Π {X Y : C} (f : X ⟶ Y), strong_epi_mono_factorisation f) :
has_strong_epi_mono_factorisations C :=
⟨λ X Y f, nonempty.intro $ d f⟩
@[priority 100]
instance has_images_of_has_strong_epi_mono_factorisations
[has_strong_epi_mono_factorisations C] : has_images C :=
{ has_image := λ X Y f,
let F' := classical.choice (has_strong_epi_mono_factorisations.has_fac f) in
has_image.mk { F := F'.to_mono_factorisation,
is_image := F'.to_mono_is_image } }
end strong_epi_mono_factorisation
section has_strong_epi_images
variables (C) [has_images C]
/-- A category has strong epi images if it has all images and `factor_thru_image f` is a strong
epimorphism for all `f`. -/
class has_strong_epi_images : Prop :=
(strong_factor_thru_image : Π {X Y : C} (f : X ⟶ Y), strong_epi (factor_thru_image f))
attribute [instance] has_strong_epi_images.strong_factor_thru_image
end has_strong_epi_images
section has_strong_epi_images
/-- If there is a single strong epi-mono factorisation of `f`, then every image factorisation is a
strong epi-mono factorisation. -/
lemma strong_epi_of_strong_epi_mono_factorisation {X Y : C} {f : X ⟶ Y}
(F : strong_epi_mono_factorisation f) {F' : mono_factorisation f} (hF' : is_image F') :
strong_epi F'.e :=
by { rw ←is_image.e_iso_ext_hom F.to_mono_is_image hF', apply strong_epi_comp }
lemma strong_epi_factor_thru_image_of_strong_epi_mono_factorisation {X Y : C} {f : X ⟶ Y}
[has_image f] (F : strong_epi_mono_factorisation f) : strong_epi (factor_thru_image f) :=
strong_epi_of_strong_epi_mono_factorisation F $ image.is_image f
/-- If we constructed our images from strong epi-mono factorisations, then these images are
strong epi images. -/
@[priority 100]
instance has_strong_epi_images_of_has_strong_epi_mono_factorisations
[has_strong_epi_mono_factorisations C] : has_strong_epi_images C :=
{ strong_factor_thru_image := λ X Y f,
strong_epi_factor_thru_image_of_strong_epi_mono_factorisation $
classical.choice $ has_strong_epi_mono_factorisations.has_fac f }
end has_strong_epi_images
section has_strong_epi_images
variables [has_images C]
/-- A category with strong epi images has image maps. -/
@[priority 100]
instance has_image_maps_of_has_strong_epi_images [has_strong_epi_images C] :
has_image_maps C :=
{ has_image_map := λ f g st, has_image_map.mk
{ map := (comm_sq.mk (show (st.left ≫ factor_thru_image g.hom) ≫ image.ι g.hom =
factor_thru_image f.hom ≫ (image.ι f.hom ≫ st.right), by simp)).lift, }, }
/-- If a category has images, equalizers and pullbacks, then images are automatically strong epi
images. -/
@[priority 100]
instance has_strong_epi_images_of_has_pullbacks_of_has_equalizers [has_pullbacks C]
[has_equalizers C] : has_strong_epi_images C :=
{ strong_factor_thru_image := λ X Y f, strong_epi.mk'
(λ A B h h_mono x y sq, comm_sq.has_lift.mk'
{ l := image.lift
{ I := pullback h y,
m := pullback.snd ≫ image.ι f,
m_mono := by exactI mono_comp _ _,
e := pullback.lift _ _ sq.w } ≫ pullback.fst,
fac_left' := by simp only [image.fac_lift_assoc, pullback.lift_fst],
fac_right' := by { ext, simp only [sq.w, category.assoc,
image.fac_lift_assoc, pullback.lift_fst_assoc], }, }) }
end has_strong_epi_images
variables [has_strong_epi_mono_factorisations C]
variables {X Y : C} {f : X ⟶ Y}
/--
If `C` has strong epi mono factorisations, then the image is unique up to isomorphism, in that if
`f` factors as a strong epi followed by a mono, this factorisation is essentially the image
factorisation.
-/
def image.iso_strong_epi_mono {I' : C} (e : X ⟶ I') (m : I' ⟶ Y) (comm : e ≫ m = f) [strong_epi e]
[mono m] :
I' ≅ image f :=
is_image.iso_ext {strong_epi_mono_factorisation . I := I', m := m, e := e}.to_mono_is_image $
image.is_image f
@[simp]
lemma image.iso_strong_epi_mono_hom_comp_ι {I' : C} (e : X ⟶ I') (m : I' ⟶ Y) (comm : e ≫ m = f)
[strong_epi e] [mono m] :
(image.iso_strong_epi_mono e m comm).hom ≫ image.ι f = m :=
is_image.lift_fac _ _
@[simp]
lemma image.iso_strong_epi_mono_inv_comp_mono {I' : C} (e : X ⟶ I') (m : I' ⟶ Y) (comm : e ≫ m = f)
[strong_epi e] [mono m] :
(image.iso_strong_epi_mono e m comm).inv ≫ m = image.ι f :=
image.lift_fac _
end category_theory.limits
namespace category_theory.functor
open category_theory.limits
variables {C D : Type*} [category C] [category D]
lemma has_strong_epi_mono_factorisations_imp_of_is_equivalence (F : C ⥤ D) [is_equivalence F]
[h : has_strong_epi_mono_factorisations C] :
has_strong_epi_mono_factorisations D :=
⟨λ X Y f, begin
let em : strong_epi_mono_factorisation (F.inv.map f) :=
(has_strong_epi_mono_factorisations.has_fac (F.inv.map f)).some,
haveI : mono (F.map em.m ≫ F.as_equivalence.counit_iso.hom.app Y) := mono_comp _ _,
haveI : strong_epi (F.as_equivalence.counit_iso.inv.app X ≫ F.map em.e) := strong_epi_comp _ _,
exact nonempty.intro
{ I := F.obj em.I,
e := F.as_equivalence.counit_iso.inv.app X ≫ F.map em.e,
m := F.map em.m ≫ F.as_equivalence.counit_iso.hom.app Y,
fac' := by simpa only [category.assoc, ← F.map_comp_assoc, em.fac',
is_equivalence.fun_inv_map, iso.inv_hom_id_app, iso.inv_hom_id_app_assoc]
using category.comp_id _, },
end⟩
end category_theory.functor
|
State Before: α : Type u
β : Type v
γ : Type w
s✝ s₁ s₂ : Finset α
a✝ : α
b : β
f✝ g : α → β
inst✝¹ : NonAssocSemiring β
inst✝ : DecidableEq α
s : Finset α
f : α → β
a : α
⊢ (∑ x in s, f x * if a = x then 1 else 0) = if a ∈ s then f a else 0 State After: no goals Tactic: simp |
/**************************************************************
*
* 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 INCLUDED_BORDERHANDLER_HXX
#define INCLUDED_BORDERHANDLER_HXX
#include <WriterFilterDllApi.hxx>
#include <resourcemodel/LoggedResources.hxx>
#include <boost/shared_ptr.hpp>
#include <com/sun/star/table/BorderLine.hpp>
namespace writerfilter {
namespace dmapper
{
class PropertyMap;
class WRITERFILTER_DLLPRIVATE BorderHandler : public LoggedProperties
{
public:
//todo: order is a guess
enum BorderPosition
{
BORDER_TOP,
BORDER_LEFT,
BORDER_BOTTOM,
BORDER_RIGHT,
BORDER_HORIZONTAL,
BORDER_VERTICAL,
BORDER_COUNT
};
private:
sal_Int8 m_nCurrentBorderPosition;
//values of the current border
sal_Int32 m_nLineWidth;
sal_Int32 m_nLineType;
sal_Int32 m_nLineColor;
sal_Int32 m_nLineDistance;
bool m_bOOXML;
bool m_aFilledLines[BORDER_COUNT];
::com::sun::star::table::BorderLine m_aBorderLines[BORDER_COUNT];
// Properties
virtual void lcl_attribute(Id Name, Value & val);
virtual void lcl_sprm(Sprm & sprm);
public:
BorderHandler( bool bOOXML );
virtual ~BorderHandler();
::boost::shared_ptr<PropertyMap> getProperties();
::com::sun::star::table::BorderLine getBorderLine();
sal_Int32 getLineDistance() const { return m_nLineDistance;}
};
typedef boost::shared_ptr< BorderHandler > BorderHandlerPtr;
}}
#endif //
|
# Optimización de ganancía
+ Buscar la manera más optima de obtener la ganancía deseada.
## Objetivo general
+ Lo que buscamos con este es proyecto es obtener 1,000 pesos mexicanos como ganancía después de comprar y vender monedas al tipo de cambio del día de hoy.
## Objetivos especificos
### Definición de proyecto
+ Definir las variables.
+ Definir las restricciones.
+ Definir la función a maximizar.
### Programado
+ Aplicar los aprendizajes obtenidos en el modulo 1, con respecto a la programación lineal y resolverlo programando con python.
## Las modenas y su tipo de cambio que tomaremos en cuenta son las siguientes:
```python
import sympy as sym #Importamos librerias
import numpy as np
from scipy.optimize import linprog
```
```python
f1 = np.array([[-1,-1,-1,-1,0.052,0,0,0,0.046,0,0,0,5.62,0,0,0,0.041,0,0,0]])
f2 = np.array([[19.1,0,0,0,-1,-1,-1,-1,0.87,0,0,0,107.32,0,0,0,0.79,0,0,0]])
f3 = np.array([[0,21.77,0,0,0,1.14,0,0,-1,-1,-1,-1,0,0,122.3,0,0,0,0.88,0]])
f4 = np.array([[0,0,0.18,0,0,0,0.0093,0,0,0,0.0083,0,-1,-1,-1,-1,0,0,0,0.0073]])
f5 = np.array([[0,0,0,24.38,0,0,0,1.28,0,0,0,1.12,0,0,0,136.74,-1,-1,-1,-1]])
b = np.array([[0,0,0,0,1000]])
```
```python
A=np.concatenate ((-f1,-f2),axis=0)
A=np.concatenate ((A,-f3),axis=0)
A=np.concatenate ((A,-f4),axis=0)
A=np.concatenate ((A,-f5),axis=0)
```
```python
resultado = opt.linprog(-f1[0],A_ub=A,b_ub=b)
resultado
```
```python
```
|
section \<open>Underlying FSM Representation\<close>
text \<open>This theory contains the underlying datatype for (possibly not well-formed) finite state
machines that is restricted to well-formed finite state machines in later theories.\<close>
theory FSM_Impl
imports Util Datatype_Order_Generator.Order_Generator
begin
text \<open>A finite state machine (FSM) is represented using its classical definition:\<close>
record ('state, 'input, 'output) fsm_impl =
initial :: 'state
nodes :: "'state set"
inputs :: "'input set"
outputs :: "'output set"
transitions :: "('state \<times> 'input \<times> 'output \<times> 'state) set"
subsection \<open>Types for Transitions and Paths\<close>
type_synonym ('a,'b,'c) transition = "('a \<times> 'b \<times> 'c \<times> 'a)"
type_synonym ('a,'b,'c) path = "('a,'b,'c) transition list"
abbreviation "t_source (a :: ('a,'b,'c) transition) \<equiv> fst a"
abbreviation "t_input (a :: ('a,'b,'c) transition) \<equiv> fst (snd a)"
abbreviation "t_output (a :: ('a,'b,'c) transition) \<equiv> fst (snd (snd a))"
abbreviation "t_target (a :: ('a,'b,'c) transition) \<equiv> snd (snd (snd a))"
subsection \<open>Basic Algorithms on FSM\<close>
subsubsection \<open>Reading FSMs from Lists\<close>
fun fsm_impl_from_list :: "'a \<Rightarrow> ('a \<times> 'b \<times> 'c \<times> 'a) list \<Rightarrow> ('a, 'b, 'c) fsm_impl" where
"fsm_impl_from_list q [] = \<lparr> initial = q, nodes = {q}, inputs = {}, outputs = {}, transitions = {} \<rparr>" |
"fsm_impl_from_list q (t#ts) = (let ts' = set (t#ts)
in \<lparr> initial = t_source t
, nodes = (image t_source ts') \<union> (image t_target ts')
, inputs = image t_input ts'
, outputs = image t_output ts'
, transitions = ts' \<rparr>)"
fun fsm_impl_from_list' :: "'a \<Rightarrow> ('a \<times> 'b \<times> 'c \<times> 'a) list \<Rightarrow> ('a, 'b, 'c) fsm_impl" where
"fsm_impl_from_list' q [] = \<lparr> initial = q, nodes = {q}, inputs = {}, outputs = {}, transitions = {} \<rparr>" |
"fsm_impl_from_list' q (t#ts) = (let tsr = (remdups (t#ts))
in \<lparr> initial = t_source t
, nodes = set (remdups ((map t_source tsr) @ (map t_target tsr)))
, inputs = set (remdups (map t_input tsr))
, outputs = set (remdups (map t_output tsr))
, transitions = set tsr \<rparr>)"
lemma fsm_impl_from_list_code[code] :
"fsm_impl_from_list q ts = fsm_impl_from_list' q ts"
by (cases ts; auto)
subsubsection \<open>Changing the initial State\<close>
fun from_FSM :: "('a,'b,'c) fsm_impl \<Rightarrow> 'a \<Rightarrow> ('a,'b,'c) fsm_impl" where
"from_FSM M q = (if q \<in> nodes M then \<lparr> initial = q, nodes = nodes M, inputs = inputs M, outputs = outputs M, transitions = transitions M \<rparr> else M)"
subsubsection \<open>Product Construction\<close>
fun product :: "('a,'b,'c) fsm_impl \<Rightarrow> ('d,'b,'c) fsm_impl \<Rightarrow> ('a \<times> 'd,'b,'c) fsm_impl" where
"product A B = \<lparr> initial = (initial A, initial B),
nodes = (nodes A) \<times> (nodes B),
inputs = inputs A \<union> inputs B,
outputs = outputs A \<union> outputs B,
transitions = {((qA,qB),x,y,(qA',qB')) | qA qB x y qA' qB' . (qA,x,y,qA') \<in> transitions A \<and> (qB,x,y,qB') \<in> transitions B} \<rparr>"
lemma product_code_naive[code] :
"product A B = \<lparr> initial = (initial A, initial B),
nodes = (nodes A) \<times> (nodes B) ,
inputs = inputs A \<union> inputs B,
outputs = outputs A \<union> outputs B,
transitions = image (\<lambda>((qA,x,y,qA'), (qB,x',y',qB')) . ((qA,qB),x,y,(qA',qB'))) (Set.filter (\<lambda>((qA,x,y,qA'), (qB,x',y',qB')) . x = x' \<and> y = y') (\<Union>(image (\<lambda> tA . image (\<lambda> tB . (tA,tB)) (transitions B)) (transitions A)))) \<rparr>"
(is "?P1 = ?P2")
proof -
have "(\<Union>(image (\<lambda> tA . image (\<lambda> tB . (tA,tB)) (transitions B)) (transitions A))) = {(tA,tB) | tA tB . tA \<in> transitions A \<and> tB \<in> transitions B}"
by auto
then have "(Set.filter (\<lambda>((qA,x,y,qA'), (qB,x',y',qB')) . x = x' \<and> y = y') (\<Union>(image (\<lambda> tA . image (\<lambda> tB . (tA,tB)) (transitions B)) (transitions A)))) = {((qA,x,y,qA'),(qB,x,y,qB')) | qA qB x y qA' qB' . (qA,x,y,qA') \<in> transitions A \<and> (qB,x,y,qB') \<in> transitions B}"
by auto
then have "image (\<lambda>((qA,x,y,qA'), (qB,x',y',qB')) . ((qA,qB),x,y,(qA',qB'))) (Set.filter (\<lambda>((qA,x,y,qA'), (qB,x',y',qB')) . x = x' \<and> y = y') (\<Union>(image (\<lambda> tA . image (\<lambda> tB . (tA,tB)) (transitions B)) (transitions A))))
= image (\<lambda>((qA,x,y,qA'), (qB,x',y',qB')) . ((qA,qB),x,y,(qA',qB'))) {((qA,x,y,qA'),(qB,x,y,qB')) | qA qB x y qA' qB' . (qA,x,y,qA') \<in> transitions A \<and> (qB,x,y,qB') \<in> transitions B}"
by auto
moreover have "image (\<lambda>((qA,x,y,qA'), (qB,x',y',qB')) . ((qA,qB),x,y,(qA',qB'))) {((qA,x,y,qA'),(qB,x,y,qB')) | qA qB x y qA' qB' . (qA,x,y,qA') \<in> transitions A \<and> (qB,x,y,qB') \<in> transitions B} = {((qA,qB),x,y,(qA',qB')) | qA qB x y qA' qB' . (qA,x,y,qA') \<in> transitions A \<and> (qB,x,y,qB') \<in> transitions B}"
by force
ultimately have "transitions ?P1 = transitions ?P2"
unfolding product.simps by auto
moreover have "initial ?P1 = initial ?P2" by auto
moreover have "nodes ?P1 = nodes ?P2" by auto
moreover have "inputs ?P1 = inputs ?P2" by auto
moreover have "outputs ?P1 = outputs ?P2" by auto
ultimately show ?thesis by auto
qed
subsubsection \<open>Filtering Transitions\<close>
fun filter_transitions :: "('a,'b,'c) fsm_impl \<Rightarrow> (('a \<times> 'b \<times> 'c \<times> 'a) \<Rightarrow> bool) \<Rightarrow> ('a,'b,'c) fsm_impl" where
"filter_transitions M P = \<lparr> initial = initial M
, nodes = nodes M
, inputs = inputs M
, outputs = outputs M
, transitions = Set.filter P (transitions M) \<rparr>"
subsubsection \<open>Filtering Nodes\<close>
fun filter_nodes :: "('a,'b,'c) fsm_impl \<Rightarrow> ('a \<Rightarrow> bool) \<Rightarrow> ('a,'b,'c) fsm_impl" where
"filter_nodes M P = (if P (initial M) then \<lparr> initial = initial M
, nodes = Set.filter P (nodes M)
, inputs = inputs M
, outputs = outputs M
, transitions = Set.filter (\<lambda> t . P (t_source t) \<and> P (t_target t)) (transitions M) \<rparr>
else M)"
subsubsection \<open>Initial Singleton FSM (For Trivial Preamble)\<close>
fun initial_singleton :: "('a,'b,'c) fsm_impl \<Rightarrow> ('a,'b,'c) fsm_impl" where
"initial_singleton M = \<lparr> initial = initial M,
nodes = {initial M},
inputs = inputs M,
outputs = outputs M,
transitions = {} \<rparr>"
subsubsection \<open>Canonical Separator\<close>
abbreviation "shift_Inl t \<equiv> (Inl (t_source t),t_input t, t_output t, Inl (t_target t))"
definition shifted_transitions :: "(('a \<times> 'a) \<times> 'b \<times> 'c \<times> ('a \<times> 'a)) set \<Rightarrow> ((('a \<times> 'a) + 'd) \<times> 'b \<times> 'c \<times> (('a \<times> 'a) + 'd)) set" where
"shifted_transitions ts = image shift_Inl ts"
definition distinguishing_transitions :: "(('a \<times> 'b) \<Rightarrow> 'c set) \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> ('a \<times> 'a) set \<Rightarrow> 'b set \<Rightarrow> ((('a \<times> 'a) + 'a) \<times> 'b \<times> 'c \<times> (('a \<times> 'a) + 'a)) set" where
"distinguishing_transitions f q1 q2 nodeSet inputSet = \<Union> (Set.image (\<lambda>((q1',q2'),x) .
(image (\<lambda>y . (Inl (q1',q2'),x,y,Inr q1)) (f (q1',x) - f (q2',x)))
\<union> (image (\<lambda>y . (Inl (q1',q2'),x,y,Inr q2)) (f (q2',x) - f (q1',x))))
(nodeSet \<times> inputSet))"
(* Note: parameter P is added to allow usage of different restricted versions of the product machine *)
fun canonical_separator' :: "('a,'b,'c) fsm_impl \<Rightarrow> (('a \<times> 'a),'b,'c) fsm_impl \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> (('a \<times> 'a) + 'a,'b,'c) fsm_impl" where
"canonical_separator' M P q1 q2 = (if initial P = (q1,q2)
then
(let f' = set_as_map (image (\<lambda>(q,x,y,q') . ((q,x),y)) (transitions M));
f = (\<lambda>qx . (case f' qx of Some yqs \<Rightarrow> yqs | None \<Rightarrow> {}));
shifted_transitions' = shifted_transitions (transitions P);
distinguishing_transitions_lr = distinguishing_transitions f q1 q2 (nodes P) (inputs P);
ts = shifted_transitions' \<union> distinguishing_transitions_lr
in
\<lparr> initial = Inl (q1,q2)
, nodes = (image Inl (nodes P)) \<union> {Inr q1, Inr q2}
, inputs = inputs M \<union> inputs P
, outputs = outputs M \<union> outputs P
, transitions = ts \<rparr>)
else \<lparr> initial = Inl (q1,q2), nodes = {Inl (q1,q2)}, inputs = {}, outputs = {}, transitions = {}\<rparr>)"
subsubsection \<open>Generalised Canonical Separator\<close>
text \<open>A variation on the state separator that uses states @{text "L"} and @{text "R"} instead of
@{text "Inr q1"} and @{text "Inr q2"} to indicate targets of transitions in the
canonical separator that are available only for the left or right component of a state pair\<close>
text \<open>Note: this definition of a canonical separator might serve as a way to avoid recalculation
of state separators for different pairs of states, but is currently not fully
implemented\<close>
datatype LR = Left | Right
derive linorder LR
definition distinguishing_transitions_LR :: "(('a \<times> 'b) \<Rightarrow> 'c set) \<Rightarrow> ('a \<times> 'a) set \<Rightarrow> 'b set \<Rightarrow> ((('a \<times> 'a) + LR) \<times> 'b \<times> 'c \<times> (('a \<times> 'a) + LR)) set" where
"distinguishing_transitions_LR f nodeSet inputSet = \<Union> (Set.image (\<lambda>((q1',q2'),x) .
(image (\<lambda>y . (Inl (q1',q2'),x,y,Inr Left)) (f (q1',x) - f (q2',x)))
\<union> (image (\<lambda>y . (Inl (q1',q2'),x,y,Inr Right)) (f (q2',x) - f (q1',x))))
(nodeSet \<times> inputSet))"
fun canonical_separator_complete' :: "('a,'b,'c) fsm_impl \<Rightarrow> (('a \<times> 'a) + LR,'b,'c) fsm_impl" where
"canonical_separator_complete' M =
(let P = product M M;
f' = set_as_map (image (\<lambda>(q,x,y,q') . ((q,x),y)) (transitions M));
f = (\<lambda>qx . (case f' qx of Some yqs \<Rightarrow> yqs | None \<Rightarrow> {}));
shifted_transitions' = shifted_transitions (transitions P);
distinguishing_transitions_lr = distinguishing_transitions_LR f (nodes P) (inputs P);
ts = shifted_transitions' \<union> distinguishing_transitions_lr
in
\<lparr> initial = Inl (initial P)
, nodes = (image Inl (nodes P)) \<union> {Inr Left, Inr Right}
, inputs = inputs M \<union> inputs P
, outputs = outputs M \<union> outputs P
, transitions = ts \<rparr>)"
subsubsection \<open>Adding Transitions\<close>
fun add_transitions :: "('a,'b,'c) fsm_impl \<Rightarrow> ('a \<times> 'b \<times> 'c \<times> 'a) set \<Rightarrow> ('a,'b,'c) fsm_impl" where
"add_transitions M ts = (if (\<forall> t \<in> ts . t_source t \<in> nodes M \<and> t_input t \<in> inputs M \<and> t_output t \<in> outputs M \<and> t_target t \<in> nodes M)
then M\<lparr> transitions := transitions M \<union> ts\<rparr>
else M)"
subsubsection \<open>Creating an FSM without transitions\<close>
fun create_unconnected_fsm :: "'a \<Rightarrow> 'a set \<Rightarrow> 'b set \<Rightarrow> 'c set \<Rightarrow> ('a,'b,'c) fsm_impl" where
"create_unconnected_fsm q ns ins outs = (if (finite ns \<and> finite ins \<and> finite outs)
then \<lparr> initial = q, nodes = insert q ns, inputs = ins, outputs = outs, transitions = {} \<rparr>
else \<lparr> initial = q, nodes = {q}, inputs = {}, outputs = {}, transitions = {} \<rparr>)"
end |
(*
* Copyright 2014, NICTA
*
* This software may be distributed and modified according to the terms of
* the BSD 2-Clause license. Note that NO WARRANTY is provided.
* See "LICENSE_BSD2.txt" for details.
*
* @TAG(NICTA_BSD)
*)
theory TypHeapLimits
imports "../../lib/TypHeapLib"
begin
definition
states_all_but_typs_eq :: "char list set \<Rightarrow> heap_raw_state \<Rightarrow> heap_raw_state \<Rightarrow> bool"
where
"states_all_but_typs_eq names hrs hrs'
= (hrs_htd hrs = hrs_htd hrs'
\<and> (\<forall>x. hrs_mem hrs x = hrs_mem hrs' x
\<or> (\<exists>p td. x \<in> {p ..+ size_td td} \<and> td_names td \<subseteq> names
\<and> typ_name td \<noteq> pad_typ_name
\<and> valid_footprint (hrs_htd hrs) p td)))"
lemma heap_list_eq_from_region_eq:
"\<forall>x \<in> {p ..+ n}. hp x = hp' x
\<Longrightarrow> heap_list hp n p = heap_list hp' n p"
apply (induct n arbitrary: p)
apply simp
apply (simp add: intvl_def)
apply (frule_tac x=p in spec, drule mp, rule_tac x=0 in exI,
simp+)
apply (erule meta_allE, erule meta_mp)
apply clarsimp
apply (drule spec, erule mp)
apply (rule_tac x="Suc k" in exI)
apply simp
done
lemma states_all_but_typs_eq_clift:
"\<lbrakk> states_all_but_typs_eq names hrs hrs';
\<forall>x \<in> td_names (typ_info_t TYPE('a)). x \<notin> names;
typ_name (typ_info_t TYPE('a)) \<noteq> pad_typ_name \<rbrakk>
\<Longrightarrow> (clift hrs :: (_ \<rightharpoonup> ('a :: c_type))) = clift hrs'"
apply (rule ext, simp add: lift_t_def)
apply (cases hrs, cases hrs', clarsimp)
apply (simp add: lift_typ_heap_def restrict_map_def)
apply (simp add: s_valid_def proj_d_lift_state
states_all_but_typs_eq_def hrs_htd_def
hrs_mem_def)
apply clarsimp
apply (simp add: heap_list_s_heap_list h_t_valid_def)
apply (subst heap_list_eq_from_region_eq, simp_all)
apply clarsimp
apply (drule spec, erule disjE, assumption)
apply clarsimp
apply (drule(1) valid_footprint_neq_disjoint)
apply (clarsimp simp: typ_uinfo_t_def typ_tag_lt_def
typ_tag_le_def)
apply (force dest: td_set_td_names
intro: td_set_td_names[OF td_set_self])
apply (clarsimp simp: field_of_def typ_uinfo_t_def)
apply (force dest: td_set_td_names
intro: td_set_td_names[OF td_set_self])
apply (simp add: size_of_def)
apply blast
done
lemma states_all_but_typs_eq_refl:
"states_all_but_typs_eq names hrs hrs"
by (simp add: states_all_but_typs_eq_def)
lemma states_all_but_typs_eq_trans:
"states_all_but_typs_eq names hrs hrs'
\<Longrightarrow> states_all_but_typs_eq names hrs' hrs''
\<Longrightarrow> states_all_but_typs_eq names hrs hrs''"
apply (clarsimp simp add: states_all_but_typs_eq_def
del: disjCI)
apply (drule_tac x=x in spec)+
apply clarsimp
done
lemma states_all_but_typs_eq_update:
"\<lbrakk> hrs_htd hrs \<Turnstile>\<^sub>t (ptr :: ('a :: c_type) ptr);
td_names (typ_info_t TYPE('a)) \<subseteq> names;
typ_name (typ_info_t TYPE('a)) \<noteq> pad_typ_name;
wf_fd (typ_info_t TYPE('a)) \<rbrakk>
\<Longrightarrow>
states_all_but_typs_eq names hrs
(hrs_mem_update (heap_update ptr v) hrs)"
apply (clarsimp simp: states_all_but_typs_eq_def hrs_mem_update
del: disjCI)
apply (subst disj_commute, rule disjCI)
apply (rule_tac x="ptr_val ptr" in exI)
apply (rule_tac x="typ_uinfo_t TYPE('a)" in exI)
apply (simp add: typ_uinfo_t_def h_t_valid_def heap_update_def)
apply (rule ccontr)
apply (subst(asm) heap_update_nmem_same)
apply (simp add: to_bytes_def length_fa_ti)
apply (subst length_fa_ti, simp_all add: size_of_def)
done
end
|
(***********************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
(* <O___,, * INRIA-Rocquencourt & LRI-CNRS-Orsay *)
(* \VV/ *************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(***********************************************************************)
(** * Finite sets library *)
(** This file proposes an implementation of the non-dependant
interface [MSetWeakInterface.S] using lists without redundancy. *)
Require Import MSetInterface.
Set Implicit Arguments.
Unset Strict Implicit.
(** * Functions over lists
First, we provide sets as lists which are (morally) without redundancy.
The specs are proved under the additional condition of no redundancy.
And the functions returning sets are proved to preserve this invariant. *)
(** ** The set operations. *)
Module Ops (X: DecidableType) <: WOps X.
Definition elt := X.t.
Definition t := list elt.
Definition empty : t := nil.
Definition is_empty (l : t) : bool := if l then true else false.
Fixpoint mem (x : elt) (s : t) : bool :=
match s with
| nil => false
| y :: l =>
if X.eq_dec x y then true else mem x l
end.
Fixpoint add (x : elt) (s : t) : t :=
match s with
| nil => x :: nil
| y :: l =>
if X.eq_dec x y then s else y :: add x l
end.
Definition singleton (x : elt) : t := x :: nil.
Fixpoint remove (x : elt) (s : t) : t :=
match s with
| nil => nil
| y :: l =>
if X.eq_dec x y then l else y :: remove x l
end.
Definition fold (B : Type) (f : elt -> B -> B) (s : t) (i : B) : B :=
fold_left (flip f) s i.
Definition union (s : t) : t -> t := fold add s.
Definition diff (s s' : t) : t := fold remove s' s.
Definition inter (s s': t) : t :=
fold (fun x s => if mem x s' then add x s else s) s nil.
Definition subset (s s' : t) : bool := is_empty (diff s s').
Definition equal (s s' : t) : bool := andb (subset s s') (subset s' s).
Fixpoint filter (f : elt -> bool) (s : t) : t :=
match s with
| nil => nil
| x :: l => if f x then x :: filter f l else filter f l
end.
Fixpoint for_all (f : elt -> bool) (s : t) : bool :=
match s with
| nil => true
| x :: l => if f x then for_all f l else false
end.
Fixpoint exists_ (f : elt -> bool) (s : t) : bool :=
match s with
| nil => false
| x :: l => if f x then true else exists_ f l
end.
Fixpoint partition (f : elt -> bool) (s : t) : t * t :=
match s with
| nil => (nil, nil)
| x :: l =>
let (s1, s2) := partition f l in
if f x then (x :: s1, s2) else (s1, x :: s2)
end.
Definition cardinal (s : t) : nat := length s.
Definition elements (s : t) : list elt := s.
Definition choose (s : t) : option elt :=
match s with
| nil => None
| x::_ => Some x
end.
End Ops.
(** ** Proofs of set operation specifications. *)
Module MakeRaw (X:DecidableType) <: WRawSets X.
Include Ops X.
Section ForNotations.
Notation NoDup := (NoDupA X.eq).
Notation In := (InA X.eq).
(* TODO: modify proofs in order to avoid these hints *)
Hint Resolve (@Equivalence_Reflexive _ _ X.eq_equiv).
Hint Immediate (@Equivalence_Symmetric _ _ X.eq_equiv).
Hint Resolve (@Equivalence_Transitive _ _ X.eq_equiv).
Definition IsOk := NoDup.
Class Ok (s:t) : Prop := ok : NoDup s.
Hint Unfold Ok.
Hint Resolve @ok.
Instance NoDup_Ok s (nd : NoDup s) : Ok s := { ok := nd }.
Ltac inv_ok := match goal with
| H:Ok (_ :: _) |- _ => inversion_clear H; inv_ok
| H:Ok nil |- _ => clear H; inv_ok
| H:NoDup ?l |- _ => change (Ok l) in H; inv_ok
| _ => idtac
end.
Ltac inv := invlist InA; inv_ok.
Ltac constructors := repeat constructor.
Fixpoint isok l := match l with
| nil => true
| a::l => negb (mem a l) && isok l
end.
Definition Equal s s' := forall a : elt, In a s <-> In a s'.
Definition Subset s s' := forall a : elt, In a s -> In a s'.
Definition Empty s := forall a : elt, ~ In a s.
Definition For_all (P : elt -> Prop) s := forall x, In x s -> P x.
Definition Exists (P : elt -> Prop) s := exists x, In x s /\ P x.
Lemma In_compat : Proper (X.eq==>eq==>iff) In.
Proof.
repeat red; intros. subst. rewrite H; auto.
Qed.
Lemma mem_spec : forall s x `{Ok s},
mem x s = true <-> In x s.
Proof.
induction s; intros.
split; intros; inv. discriminate.
simpl; destruct (X.eq_dec x a); split; intros; inv; auto.
right; rewrite <- IHs; auto.
rewrite IHs; auto.
Qed.
Lemma isok_iff : forall l, Ok l <-> isok l = true.
Proof.
induction l.
intuition.
simpl.
rewrite andb_true_iff.
rewrite negb_true_iff.
rewrite <- IHl.
split; intros H. inv.
split; auto.
apply not_true_is_false. rewrite mem_spec; auto.
destruct H; constructors; auto.
rewrite <- mem_spec; auto; congruence.
Qed.
Global Instance isok_Ok l : isok l = true -> Ok l | 10.
Proof.
intros. apply <- isok_iff; auto.
Qed.
Lemma add_spec :
forall (s : t) (x y : elt) {Hs : Ok s},
In y (add x s) <-> X.eq y x \/ In y s.
Proof.
induction s; simpl; intros.
intuition; inv; auto.
destruct X.eq_dec; inv; rewrite InA_cons, ?IHs; intuition.
left; eauto.
inv; auto.
Qed.
Global Instance add_ok s x `(Ok s) : Ok (add x s).
Proof.
induction s.
simpl; intuition.
intros; inv. simpl.
destruct X.eq_dec; auto.
constructors; auto.
intro; inv; auto.
rewrite add_spec in *; intuition.
Qed.
Lemma remove_spec :
forall (s : t) (x y : elt) {Hs : Ok s},
In y (remove x s) <-> In y s /\ ~X.eq y x.
Proof.
induction s; simpl; intros.
intuition; inv; auto.
destruct X.eq_dec; inv; rewrite !InA_cons, ?IHs; intuition.
elim H. setoid_replace a with y; eauto.
elim H3. setoid_replace x with y; eauto.
elim n. eauto.
Qed.
Global Instance remove_ok s x `(Ok s) : Ok (remove x s).
Proof.
induction s; simpl; intros.
auto.
destruct X.eq_dec; inv; auto.
constructors; auto.
rewrite remove_spec; intuition.
Qed.
Lemma singleton_ok : forall x : elt, Ok (singleton x).
Proof.
unfold singleton; simpl; constructors; auto. intro; inv.
Qed.
Lemma singleton_spec : forall x y : elt, In y (singleton x) <-> X.eq y x.
Proof.
unfold singleton; simpl; split; intros. inv; auto. left; auto.
Qed.
Lemma empty_ok : Ok empty.
Proof.
unfold empty; constructors.
Qed.
Lemma empty_spec : Empty empty.
Proof.
unfold Empty, empty; red; intros; inv.
Qed.
Lemma is_empty_spec : forall s : t, is_empty s = true <-> Empty s.
Proof.
unfold Empty; destruct s; simpl; split; intros; auto.
intro; inv.
discriminate.
elim (H e); auto.
Qed.
Lemma elements_spec1 : forall (s : t) (x : elt), In x (elements s) <-> In x s.
Proof.
unfold elements; intuition.
Qed.
Lemma elements_spec2w : forall (s : t) {Hs : Ok s}, NoDup (elements s).
Proof.
unfold elements; auto.
Qed.
Lemma fold_spec :
forall (s : t) (A : Type) (i : A) (f : elt -> A -> A),
fold f s i = fold_left (flip f) (elements s) i.
Proof.
reflexivity.
Qed.
Global Instance union_ok : forall s s' `(Ok s, Ok s'), Ok (union s s').
Proof.
induction s; simpl; auto; intros; inv; unfold flip; auto with *.
Qed.
Lemma union_spec :
forall (s s' : t) (x : elt) {Hs : Ok s} {Hs' : Ok s'},
In x (union s s') <-> In x s \/ In x s'.
Proof.
induction s; simpl in *; unfold flip; intros; auto; inv.
intuition; inv.
rewrite IHs, add_spec, InA_cons; intuition.
Qed.
Global Instance inter_ok s s' `(Ok s, Ok s') : Ok (inter s s').
Proof.
unfold inter, fold, flip.
set (acc := nil (A:=elt)).
assert (Hacc : Ok acc) by constructors.
clearbody acc; revert acc Hacc.
induction s; simpl; auto; intros. inv.
apply IHs; auto.
destruct (mem a s'); auto with *.
Qed.
Lemma inter_spec :
forall (s s' : t) (x : elt) {Hs : Ok s} {Hs' : Ok s'},
In x (inter s s') <-> In x s /\ In x s'.
Proof.
unfold inter, fold, flip; intros.
set (acc := nil (A:=elt)) in *.
assert (Hacc : Ok acc) by constructors.
assert (IFF : (In x s /\ In x s') <-> (In x s /\ In x s') \/ In x acc).
intuition; unfold acc in *; inv.
rewrite IFF; clear IFF. clearbody acc.
revert acc Hacc x s' Hs Hs'.
induction s; simpl; intros.
intuition; inv.
inv.
case_eq (mem a s'); intros Hm.
rewrite IHs, add_spec, InA_cons; intuition.
rewrite mem_spec in Hm; auto.
left; split; auto. rewrite H1; auto.
rewrite IHs, InA_cons; intuition.
rewrite H2, <- mem_spec in H3; auto. congruence.
Qed.
Global Instance diff_ok : forall s s' `(Ok s, Ok s'), Ok (diff s s').
Proof.
unfold diff; intros s s'; revert s.
induction s'; simpl; unfold flip; auto; intros. inv; auto with *.
Qed.
Lemma diff_spec :
forall (s s' : t) (x : elt) {Hs : Ok s} {Hs' : Ok s'},
In x (diff s s') <-> In x s /\ ~In x s'.
Proof.
unfold diff; intros s s'; revert s.
induction s'; simpl; unfold flip.
intuition; inv.
intros. inv.
rewrite IHs', remove_spec, InA_cons; intuition.
Qed.
Lemma subset_spec :
forall (s s' : t) {Hs : Ok s} {Hs' : Ok s'},
subset s s' = true <-> Subset s s'.
Proof.
unfold subset, Subset; intros.
rewrite is_empty_spec.
unfold Empty; intros.
intuition.
specialize (H a). rewrite diff_spec in H; intuition.
rewrite <- (mem_spec a) in H |- *. destruct (mem a s'); intuition.
rewrite diff_spec in H0; intuition.
Qed.
Lemma equal_spec :
forall (s s' : t) {Hs : Ok s} {Hs' : Ok s'},
equal s s' = true <-> Equal s s'.
Proof.
unfold Equal, equal; intros.
rewrite andb_true_iff, !subset_spec.
unfold Subset; intuition. rewrite <- H; auto. rewrite H; auto.
Qed.
Definition choose_spec1 :
forall (s : t) (x : elt), choose s = Some x -> In x s.
Proof.
destruct s; simpl; intros; inversion H; auto.
Qed.
Definition choose_spec2 : forall s : t, choose s = None -> Empty s.
Proof.
destruct s; simpl; intros.
intros x H0; inversion H0.
inversion H.
Qed.
Lemma cardinal_spec :
forall (s : t) {Hs : Ok s}, cardinal s = length (elements s).
Proof.
auto.
Qed.
Lemma filter_spec' : forall s x f,
In x (filter f s) -> In x s.
Proof.
induction s; simpl.
intuition; inv.
intros; destruct (f a); inv; intuition; right; eauto.
Qed.
Lemma filter_spec :
forall (s : t) (x : elt) (f : elt -> bool),
Proper (X.eq==>eq) f ->
(In x (filter f s) <-> In x s /\ f x = true).
Proof.
induction s; simpl.
intuition; inv.
intros.
destruct (f a) as [ ]_eqn:E; rewrite ?InA_cons, IHs; intuition.
setoid_replace x with a; auto.
setoid_replace a with x in E; auto. congruence.
Qed.
Global Instance filter_ok s f `(Ok s) : Ok (filter f s).
Proof.
induction s; simpl.
auto.
intros; inv.
case (f a); auto.
constructors; auto.
contradict H0.
eapply filter_spec'; eauto.
Qed.
Lemma for_all_spec :
forall (s : t) (f : elt -> bool),
Proper (X.eq==>eq) f ->
(for_all f s = true <-> For_all (fun x => f x = true) s).
Proof.
unfold For_all; induction s; simpl.
intuition. inv.
intros; inv.
destruct (f a) as [ ]_eqn:F.
rewrite IHs; intuition. inv; auto.
setoid_replace x with a; auto.
split; intros H'; try discriminate.
intros.
rewrite <- F, <- (H' a); auto.
Qed.
Lemma exists_spec :
forall (s : t) (f : elt -> bool),
Proper (X.eq==>eq) f ->
(exists_ f s = true <-> Exists (fun x => f x = true) s).
Proof.
unfold Exists; induction s; simpl.
split; [discriminate| intros (x & Hx & _); inv].
intros.
destruct (f a) as [ ]_eqn:F.
split; auto.
exists a; auto.
rewrite IHs; firstorder.
inv.
setoid_replace a with x in F; auto; congruence.
exists x; auto.
Qed.
Lemma partition_spec1 :
forall (s : t) (f : elt -> bool),
Proper (X.eq==>eq) f ->
Equal (fst (partition f s)) (filter f s).
Proof.
simple induction s; simpl; auto; unfold Equal.
firstorder.
intros x l Hrec f Hf.
generalize (Hrec f Hf); clear Hrec.
case (partition f l); intros s1 s2; simpl; intros.
case (f x); simpl; firstorder; inversion H0; intros; firstorder.
Qed.
Lemma partition_spec2 :
forall (s : t) (f : elt -> bool),
Proper (X.eq==>eq) f ->
Equal (snd (partition f s)) (filter (fun x => negb (f x)) s).
Proof.
simple induction s; simpl; auto; unfold Equal.
firstorder.
intros x l Hrec f Hf.
generalize (Hrec f Hf); clear Hrec.
case (partition f l); intros s1 s2; simpl; intros.
case (f x); simpl; firstorder; inversion H0; intros; firstorder.
Qed.
Lemma partition_ok1' :
forall (s : t) {Hs : Ok s} (f : elt -> bool)(x:elt),
In x (fst (partition f s)) -> In x s.
Proof.
induction s; simpl; auto; intros. inv.
generalize (IHs H1 f x).
destruct (f a); destruct (partition f s); simpl in *; auto.
inversion_clear H; auto.
Qed.
Lemma partition_ok2' :
forall (s : t) {Hs : Ok s} (f : elt -> bool)(x:elt),
In x (snd (partition f s)) -> In x s.
Proof.
induction s; simpl; auto; intros. inv.
generalize (IHs H1 f x).
destruct (f a); destruct (partition f s); simpl in *; auto.
inversion_clear H; auto.
Qed.
Global Instance partition_ok1 : forall s f `(Ok s), Ok (fst (partition f s)).
Proof.
simple induction s; simpl.
auto.
intros x l Hrec f Hs; inv.
generalize (@partition_ok1' _ _ f x).
generalize (Hrec f H0).
case (f x); case (partition f l); simpl; constructors; auto.
Qed.
Global Instance partition_ok2 : forall s f `(Ok s), Ok (snd (partition f s)).
Proof.
simple induction s; simpl.
auto.
intros x l Hrec f Hs; inv.
generalize (@partition_ok2' _ _ f x).
generalize (Hrec f H0).
case (f x); case (partition f l); simpl; constructors; auto.
Qed.
End ForNotations.
Definition In := InA X.eq.
Definition eq := Equal.
Instance eq_equiv : Equivalence eq := _.
End MakeRaw.
(** * Encapsulation
Now, in order to really provide a functor implementing [S], we
need to encapsulate everything into a type of lists without redundancy. *)
Module Make (X: DecidableType) <: WSets with Module E := X.
Module Raw := MakeRaw X.
Include WRaw2Sets X Raw.
End Make.
|
If $f$ is a holomorphic function on an open connected set $S$ and $\xi, \phi \in S$ with $f(\phi) \neq f(\xi)$, then there exists a positive constant $k$ and a positive integer $n$ such that for all $w \in S$ with $|w - \xi| < r$, we have $k|w - \xi|^n \leq |f(w) - f(\xi)|$. |
lemma bounded_scaleR_comp: fixes f :: "'a \<Rightarrow> 'b::real_normed_vector" assumes "bounded (f ` S)" shows "bounded ((\<lambda>x. r *\<^sub>R f x) ` S)" |
International House Davis, also known as IHouse, provides services to foreign students, scholars, visitors and the community. More than 40 groups from UC Davis and Sacramento use IHouse. Its purpose is to promote respect and appreciation for all peoples and cultures and to work for world peace. IHouse is primarily volunteerrun and its overarching goal is creating programs to promote international awareness and education. Funds to support IHouse come from a variety of sources including member donors, fundraising events, grants, and city and university support. Currently, student/scholar membership is $20/year and individual membership is $40/year other rates are available and posted on the IHouse site. Members receive a monthly newsletter, special reception/event invitations, discounts on other IHouse events and free language classes. Although it is not a part of the University, International House works closely with Services for International Students & Scholars SISS, which maintains two http://siss.ucdavis.edu/listserv.cfm list servers through which announcements are posted as well as notices of rooms available, items for sale, rides wanted, etc. IHouse is also home to events involving Davis and our Sister Cities. Its largest event is the http://www.internationalfestivaldavis.org/ International Festival.
Some of the events and services sponsored by IHouse to help foreign visitors acclimate are listed below, but all IHouse events are open to the entire community. By encouraging both local and foreign participation, IHouse becomes a successful bridge for cultural learning and exchange. It offers:
Monthly art exhibits by locals and internationals ArtAbout
International film series on the first and third Fridays of the month (excluding summer). Refreshments at 7:30PM and film at 8PM.
Current events lectures
International fundraisers after natural disasters like the earthquake in Haiti 2010 and the tsunami in Japan 2011
Language and conversation classes in English, German, French, Italian, Turkish and much more
Outdoor Activities Activities such as California Adventures road trips, Hiking and Backpacking hikes, dinners and parties are planned throughout the year by Club International or Club I as it is known
Thanksgiving dinner on the Saturday before the formal holiday
http://www.fpa.org/infourl_nocat4705/infourl_nocat.htm Great Decisions Global Affairs Education Discussion Program, hosted by a local exForeign Service officer
Yoga classes on Mondays from 6:007:15pm (taught by Loshan Ostrava) and Wednesdays from 5:306:30pm (taught by Dr. Uma Kunda)
Salsa classes on Mondays from 7:308:30pm (taught by Carlos Whyles)
Argentine Tango classes on Tuesdays from 6:007:30pm (taught by Damien Kima)
International House Davis also provides hospitality for new arrivals and is the official city of Davis host for greeting international visitors to the city. Be sure to visit the IHouse website and look through some of their newsletters to get a better idea of how IHouse has created community and cultural exchange opportunities for international visitors to Davis.
International visitors should check out our Housing Guide to get an idea of Davis rental housing situation and check our Navigating Davis page to help with orientation when first arriving at the train station.
The IHouse also rents out rooms in its house at 10 College Park, one of the best addresses in Davis. (We are right next door to The Chancellors House the Chancellors residence.) We have a lovely community room that seats 64 people (at eight round tables) for private parties, dinners, or weddings.
Although International House Davis has been http://www.davisenterprise.com/localnews/internationalhouse%E2%80%94ofpancakesforaday/ known to serve pancakes, they are not connected in any way with the International House of Pancakes.
Pictures
|
immutable EnumerableJoin{T,TKey,TI,SO,SI,OKS,IKS,RS} <: Enumerable{T}
outer::SO
inner::SI
outerKeySelector::OKS
innerKeySelector::IKS
resultSelector::RS
end
function join{TO,TI}(outer::Enumerable{TO}, inner::Enumerable{TI}, f_outerKeySelector::Function, outerKeySelector::Expr, f_innerKeySelector::Function, innerKeySelector::Expr, f_resultSelector::Function, resultSelector::Expr)
TKeyOuter = Base.return_types(f_outerKeySelector, (TO,))[1]
TKeyInner = Base.return_types(f_innerKeySelector, (TI,))[1]
if TKeyOuter!=TKeyInner
error("The keys in the join clause have different types, $TKeyOuter and $TKeyInner.")
end
SO = typeof(outer)
SI = typeof(inner)
T = Base.return_types(f_resultSelector, (TO,TI))[1]
return EnumerableJoin{T,TKeyOuter,TI,SO,SI,FunctionWrapper{TKeyOuter,Tuple{TO}},FunctionWrapper{TKeyInner,Tuple{TI}},FunctionWrapper{T,Tuple{TO,TI}}}(outer,inner,f_outerKeySelector,f_innerKeySelector,f_resultSelector)
end
# TODO This should be changed to a lazy implementation
function start{T,TKeyOuter,TI,SO,SI,OKS,IKS,RS}(iter::EnumerableJoin{T,TKeyOuter,TI,SO,SI,OKS,IKS,RS})
results = Array(T,0)
inner_dict = OrderedDict{TKeyOuter,Array{TI,1}}()
for i in iter.inner
key = iter.innerKeySelector(i)
if !haskey(inner_dict, key)
inner_dict[key] = Array(TI,0)
end
push!(inner_dict[key], i)
end
for i in iter.outer
outerKey = iter.outerKeySelector(i)
if haskey(inner_dict,outerKey)
for j in inner_dict[outerKey]
push!(results, iter.resultSelector(i,j))
end
end
end
return results,1
end
function next{T,TKeyOuter,TI,SO,SI,OKS,IKS,RS}(iter::EnumerableJoin{T,TKeyOuter,TI,SO,SI,OKS,IKS,RS},state)
results = state[1]
curr_index = state[2]
return results[curr_index], (results, curr_index+1)
end
function done{T,TKeyOuter,TI,SO,SI,OKS,IKS,RS}(iter::EnumerableJoin{T,TKeyOuter,TI,SO,SI,OKS,IKS,RS},state)
results = state[1]
curr_index = state[2]
return curr_index > length(results)
end
|
{-# OPTIONS --without-K --safe #-}
open import Categories.Category.Monoidal.Structure using (MonoidalCategory)
module Categories.Category.Construction.MonoidalFunctors {o ℓ e o′ ℓ′ e′}
(C : MonoidalCategory o ℓ e) (D : MonoidalCategory o′ ℓ′ e′) where
-- The functor category for a given pair of monoidal categories
open import Level
open import Data.Product using (_,_)
open import Relation.Binary.Construct.On using (isEquivalence)
open import Categories.Category using (Category)
open import Categories.Category.Monoidal
open import Categories.Functor.Monoidal
import Categories.NaturalTransformation.Monoidal as NT
open import Categories.NaturalTransformation.Equivalence
using (_≃_; ≃-isEquivalence)
open MonoidalCategory D
module Lax where
MonoidalFunctors : Category (o ⊔ ℓ ⊔ e ⊔ o′ ⊔ ℓ′ ⊔ e′) (o ⊔ ℓ ⊔ ℓ′ ⊔ e′)
(o ⊔ e′)
MonoidalFunctors = record
{ Obj = MonoidalFunctor C D
; _⇒_ = MonoidalNaturalTransformation
; _≈_ = λ α β → U α ≃ U β
; id = idNT
; _∘_ = _∘ᵥ_
; assoc = assoc
; sym-assoc = sym-assoc
; identityˡ = identityˡ
; identityʳ = identityʳ
; identity² = identity²
; equiv = isEquivalence U ≃-isEquivalence
; ∘-resp-≈ = λ α₁≈β₁ α₂≈β₂ → ∘-resp-≈ α₁≈β₁ α₂≈β₂
}
where
open NT.Lax renaming (id to idNT)
open MonoidalNaturalTransformation using (U)
module Strong where
MonoidalFunctors : Category (o ⊔ ℓ ⊔ e ⊔ o′ ⊔ ℓ′ ⊔ e′) (o ⊔ ℓ ⊔ ℓ′ ⊔ e′)
(o ⊔ e′)
MonoidalFunctors = record
{ Obj = StrongMonoidalFunctor C D
; _⇒_ = MonoidalNaturalTransformation
; _≈_ = λ α β → U α ≃ U β
; id = idNT
; _∘_ = _∘ᵥ_
; assoc = assoc
; sym-assoc = sym-assoc
; identityˡ = identityˡ
; identityʳ = identityʳ
; identity² = identity²
; equiv = isEquivalence U ≃-isEquivalence
; ∘-resp-≈ = λ α₁≈β₁ α₂≈β₂ → ∘-resp-≈ α₁≈β₁ α₂≈β₂
}
where
open NT.Strong renaming (id to idNT)
open MonoidalNaturalTransformation using (U)
|
[STATEMENT]
lemma monom_inv_ConsD: "monom_inv (x # xs) \<Longrightarrow> monom_inv xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. monom_inv (x # xs) \<Longrightarrow> monom_inv xs
[PROOF STEP]
by (auto simp: monom_inv_def) |
module MLLabelUtils
using StatsBase
using LearnBase
using MappedArrays
import Base.Broadcast: broadcastable
export
ind2label,
label2ind,
labeltype,
label,
nlabel,
poslabel,
neglabel,
isposlabel,
isneglabel,
ObsDim,
classify,
classify!,
convertlabel,
# convertlabel!,
labelmap,
labelmap!,
labelfreq,
labelfreq!,
labelmap2vec,
LabelEnc,
labelenc,
islabelenc,
convertlabelview
include("learnbase.jl")
include("labelencoding.jl")
include("classify.jl")
include("convertlabel.jl")
include("labelmap.jl")
end # module
|
import os
import matplotlib.pyplot as plt
import seaborn as sns
import statsmodels.api as sm
from statsmodels.formula.api import ols
from visualize.all_tasks import save_plot
from utils.save_data import write_csv
def plot_sight_vs_outcomes(data, path):
for outcome in ['offset', 'precision', 'fps']:
fig, ax = plt.subplots(nrows=1, ncols=1, figsize=(8, 8))
fig.suptitle((outcome + 'vs sight'), fontsize=20)
sns.boxplot(ax=ax, x='sight', y=outcome, data=data)
ax.tick_params(labelrotation=45, labelsize=13)
ax.tick_params(axis='y', labelrotation=None)
nobs = data['sight'].value_counts().values
nobs = [str(x) for x in nobs.tolist()]
nobs = ["n: " + i for i in nobs]
# Add it to the plot
pos = range(len(nobs))
max_value = data[outcome].max()
y_pos = max_value + max_value * 0.1
for tick, label in zip(pos, ax.get_xticklabels()):
ax.text(
pos[tick], y_pos, nobs[tick],
verticalalignment='top',
horizontalalignment='center', size=13, weight='normal')
save_plot(file_name=outcome + '_vs_sight',
path=os.path.join(path))
|
/-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen
-/
import algebra.invertible
import linear_algebra.bilinear_form
import linear_algebra.determinant
import linear_algebra.special_linear_group
/-!
# Quadratic forms
This file defines quadratic forms over a `R`-module `M`.
A quadratic form is a map `Q : M → R` such that
(`to_fun_smul`) `Q (a • x) = a * a * Q x`
(`polar_...`) The map `polar Q := λ x y, Q (x + y) - Q x - Q y` is bilinear.
They come with a scalar multiplication, `(a • Q) x = Q (a • x) = a * a * Q x`,
and composition with linear maps `f`, `Q.comp f x = Q (f x)`.
## Main definitions
* `quadratic_form.associated`: associated bilinear form
* `quadratic_form.pos_def`: positive definite quadratic forms
* `quadratic_form.anisotropic`: anisotropic quadratic forms
* `quadratic_form.discr`: discriminant of a quadratic form
## Main statements
* `quadratic_form.associated_left_inverse`,
* `quadratic_form.associated_right_inverse`: in a commutative ring where 2 has
an inverse, there is a correspondence between quadratic forms and symmetric
bilinear forms
* `bilin_form.exists_orthogonal_basis`: There exists an orthogonal basis with
respect to any nondegenerate, symmetric bilinear form `B`.
## Notation
In this file, the variable `R` is used when a `ring` structure is sufficient and
`R₁` is used when specifically a `comm_ring` is required. This allows us to keep
`[module R M]` and `[module R₁ M]` assumptions in the variables without
confusion between `*` from `ring` and `*` from `comm_ring`.
The variable `S` is used when `R` itself has a `•` action.
## References
* https://en.wikipedia.org/wiki/Quadratic_form
* https://en.wikipedia.org/wiki/Discriminant#Quadratic_forms
## Tags
quadratic form, homogeneous polynomial, quadratic polynomial
-/
universes u v w
variables {S : Type*}
variables {R : Type*} {M : Type*} [add_comm_group M] [ring R]
variables {R₁ : Type*} [comm_ring R₁]
namespace quadratic_form
/-- Up to a factor 2, `Q.polar` is the associated bilinear form for a quadratic form `Q`.d
Source of this name: https://en.wikipedia.org/wiki/Quadratic_form#Generalization
-/
def polar (f : M → R) (x y : M) :=
f (x + y) - f x - f y
lemma polar_add (f g : M → R) (x y : M) :
polar (f + g) x y = polar f x y + polar g x y :=
by { simp only [polar, pi.add_apply], abel }
lemma polar_neg (f : M → R) (x y : M) :
polar (-f) x y = - polar f x y :=
by { simp only [polar, pi.neg_apply, sub_eq_add_neg, neg_add] }
lemma polar_smul [monoid S] [distrib_mul_action S R] (f : M → R) (s : S) (x y : M) :
polar (s • f) x y = s • polar f x y :=
by { simp only [polar, pi.smul_apply, smul_sub] }
lemma polar_comm (f : M → R) (x y : M) : polar f x y = polar f y x :=
by rw [polar, polar, add_comm, sub_sub, sub_sub, add_comm (f x) (f y)]
end quadratic_form
variables [module R M] [module R₁ M]
open quadratic_form
/-- A quadratic form over a module. -/
structure quadratic_form (R : Type u) (M : Type v) [ring R] [add_comm_group M] [module R M] :=
(to_fun : M → R)
(to_fun_smul : ∀ (a : R) (x : M), to_fun (a • x) = a * a * to_fun x)
(polar_add_left' : ∀ (x x' y : M), polar to_fun (x + x') y = polar to_fun x y + polar to_fun x' y)
(polar_smul_left' : ∀ (a : R) (x y : M), polar to_fun (a • x) y = a • polar to_fun x y)
(polar_add_right' : ∀ (x y y' : M), polar to_fun x (y + y') = polar to_fun x y + polar to_fun x y')
(polar_smul_right' : ∀ (a : R) (x y : M), polar to_fun x (a • y) = a • polar to_fun x y)
namespace quadratic_form
variables {Q : quadratic_form R M}
instance : has_coe_to_fun (quadratic_form R M) :=
⟨_, to_fun⟩
/-- The `simp` normal form for a quadratic form is `coe_fn`, not `to_fun`. -/
@[simp] lemma to_fun_eq_apply : Q.to_fun = ⇑ Q := rfl
lemma map_smul (a : R) (x : M) : Q (a • x) = a * a * Q x := Q.to_fun_smul a x
lemma map_add_self (x : M) : Q (x + x) = 4 * Q x :=
by { rw [←one_smul R x, ←add_smul, map_smul], norm_num }
@[simp] lemma map_zero : Q 0 = 0 :=
by rw [←@zero_smul R _ _ _ _ (0 : M), map_smul, zero_mul, zero_mul]
@[simp] lemma map_neg (x : M) : Q (-x) = Q x :=
by rw [←@neg_one_smul R _ _ _ _ x, map_smul, neg_one_mul, neg_neg, one_mul]
lemma map_sub (x y : M) : Q (x - y) = Q (y - x) :=
by rw [←neg_sub, map_neg]
@[simp]
lemma polar_zero_left (y : M) : polar Q 0 y = 0 :=
by simp [polar]
@[simp]
lemma polar_add_left (x x' y : M) :
polar Q (x + x') y = polar Q x y + polar Q x' y :=
Q.polar_add_left' x x' y
@[simp]
lemma polar_smul_left (a : R) (x y : M) :
polar Q (a • x) y = a * polar Q x y :=
Q.polar_smul_left' a x y
@[simp]
lemma polar_neg_left (x y : M) :
polar Q (-x) y = -polar Q x y :=
by rw [←neg_one_smul R x, polar_smul_left, neg_one_mul]
@[simp]
lemma polar_sub_left (x x' y : M) :
polar Q (x - x') y = polar Q x y - polar Q x' y :=
by rw [sub_eq_add_neg, sub_eq_add_neg, polar_add_left, polar_neg_left]
@[simp]
lemma polar_zero_right (y : M) : polar Q y 0 = 0 :=
by simp [polar]
@[simp]
lemma polar_add_right (x y y' : M) :
polar Q x (y + y') = polar Q x y + polar Q x y' :=
Q.polar_add_right' x y y'
@[simp]
lemma polar_smul_right (a : R) (x y : M) :
polar Q x (a • y) = a * polar Q x y :=
Q.polar_smul_right' a x y
@[simp]
lemma polar_neg_right (x y : M) :
polar Q x (-y) = -polar Q x y :=
by rw [←neg_one_smul R y, polar_smul_right, neg_one_mul]
@[simp]
lemma polar_sub_right (x y y' : M) :
polar Q x (y - y') = polar Q x y - polar Q x y' :=
by rw [sub_eq_add_neg, sub_eq_add_neg, polar_add_right, polar_neg_right]
@[simp]
lemma polar_self (x : M) : polar Q x x = 2 * Q x :=
begin
rw [polar, map_add_self, sub_sub, sub_eq_iff_eq_add, ←two_mul, ←two_mul, ←mul_assoc],
norm_num
end
section of_tower
variables [comm_semiring S] [algebra S R] [module S M] [is_scalar_tower S R M]
@[simp]
lemma polar_smul_left_of_tower (a : S) (x y : M) :
polar Q (a • x) y = a • polar Q x y :=
by rw [←is_scalar_tower.algebra_map_smul R a x, polar_smul_left, algebra.smul_def]
@[simp]
lemma polar_smul_right_of_tower (a : S) (x y : M) :
polar Q x (a • y) = a • polar Q x y :=
by rw [←is_scalar_tower.algebra_map_smul R a y, polar_smul_right, algebra.smul_def]
end of_tower
variable {Q' : quadratic_form R M}
@[ext] lemma ext (H : ∀ (x : M), Q x = Q' x) : Q = Q' :=
by { cases Q, cases Q', congr, funext, apply H }
instance : has_zero (quadratic_form R M) :=
⟨ { to_fun := λ x, 0,
to_fun_smul := λ a x, by simp,
polar_add_left' := λ x x' y, by simp [polar],
polar_smul_left' := λ a x y, by simp [polar],
polar_add_right' := λ x y y', by simp [polar],
polar_smul_right' := λ a x y, by simp [polar] } ⟩
@[simp] lemma coe_fn_zero : ⇑(0 : quadratic_form R M) = 0 := rfl
@[simp] lemma zero_apply (x : M) : (0 : quadratic_form R M) x = 0 := rfl
instance : inhabited (quadratic_form R M) := ⟨0⟩
instance : has_add (quadratic_form R M) :=
⟨ λ Q Q',
{ to_fun := Q + Q',
to_fun_smul := λ a x,
by simp only [pi.add_apply, map_smul, mul_add],
polar_add_left' := λ x x' y,
by simp only [polar_add, polar_add_left, add_assoc, add_left_comm],
polar_smul_left' := λ a x y,
by simp only [polar_add, smul_eq_mul, mul_add, polar_smul_left],
polar_add_right' := λ x y y',
by simp only [polar_add, polar_add_right, add_assoc, add_left_comm],
polar_smul_right' := λ a x y,
by simp only [polar_add, smul_eq_mul, mul_add, polar_smul_right] } ⟩
@[simp] lemma coe_fn_add (Q Q' : quadratic_form R M) : ⇑(Q + Q') = Q + Q' := rfl
@[simp] lemma add_apply (Q Q' : quadratic_form R M) (x : M) : (Q + Q') x = Q x + Q' x := rfl
instance : has_neg (quadratic_form R M) :=
⟨ λ Q,
{ to_fun := -Q,
to_fun_smul := λ a x,
by simp only [pi.neg_apply, map_smul, mul_neg_eq_neg_mul_symm],
polar_add_left' := λ x x' y,
by simp only [polar_neg, polar_add_left, neg_add],
polar_smul_left' := λ a x y,
by simp only [polar_neg, polar_smul_left, mul_neg_eq_neg_mul_symm, smul_eq_mul],
polar_add_right' := λ x y y',
by simp only [polar_neg, polar_add_right, neg_add],
polar_smul_right' := λ a x y,
by simp only [polar_neg, polar_smul_right, mul_neg_eq_neg_mul_symm, smul_eq_mul] } ⟩
@[simp] lemma coe_fn_neg (Q : quadratic_form R M) : ⇑(-Q) = -Q := rfl
@[simp] lemma neg_apply (Q : quadratic_form R M) (x : M) : (-Q) x = -Q x := rfl
instance : add_comm_group (quadratic_form R M) :=
{ add := (+),
zero := 0,
neg := has_neg.neg,
add_comm := λ Q Q', by { ext, simp only [add_apply, add_comm] },
add_assoc := λ Q Q' Q'', by { ext, simp only [add_apply, add_assoc] },
add_left_neg := λ Q, by { ext, simp only [add_apply, neg_apply, zero_apply, add_left_neg] },
add_zero := λ Q, by { ext, simp only [zero_apply, add_apply, add_zero] },
zero_add := λ Q, by { ext, simp only [zero_apply, add_apply, zero_add] } }
@[simp] lemma coe_fn_sub (Q Q' : quadratic_form R M) : ⇑(Q - Q') = Q - Q' :=
by simp [sub_eq_add_neg]
@[simp] lemma sub_apply (Q Q' : quadratic_form R M) (x : M) : (Q - Q') x = Q x - Q' x :=
by simp [sub_eq_add_neg]
/-- `@coe_fn (quadratic_form R M)` as an `add_monoid_hom`.
This API mirrors `add_monoid_hom.coe_fn`. -/
@[simps apply]
def coe_fn_add_monoid_hom : quadratic_form R M →+ (M → R) :=
{ to_fun := coe_fn, map_zero' := coe_fn_zero, map_add' := coe_fn_add }
/-- Evaluation on a particular element of the module `M` is an additive map over quadratic forms. -/
@[simps apply]
def eval_add_monoid_hom (m : M) : quadratic_form R M →+ R :=
(add_monoid_hom.apply _ m).comp coe_fn_add_monoid_hom
section sum
open_locale big_operators
@[simp] lemma coe_fn_sum {ι : Type*} (Q : ι → quadratic_form R M) (s : finset ι) :
⇑(∑ i in s, Q i) = ∑ i in s, Q i :=
(coe_fn_add_monoid_hom : _ →+ (M → R)).map_sum Q s
@[simp] lemma sum_apply {ι : Type*} (Q : ι → quadratic_form R M) (s : finset ι) (x : M) :
(∑ i in s, Q i) x = ∑ i in s, Q i x :=
(eval_add_monoid_hom x : _ →+ R).map_sum Q s
end sum
section has_scalar
variables [comm_semiring S] [algebra S R]
/-- `quadratic_form R M` inherits the scalar action from any algebra over `R`.
When `R` is commutative, this provides an `R`-action via `algebra.id`. -/
instance : has_scalar S (quadratic_form R M) :=
⟨ λ a Q,
{ to_fun := a • Q,
to_fun_smul := λ b x, by rw [pi.smul_apply, map_smul, pi.smul_apply, algebra.mul_smul_comm],
polar_add_left' := λ x x' y, by simp only [polar_smul, polar_add_left, smul_add],
polar_smul_left' := λ b x y, begin
simp only [polar_smul, polar_smul_left, ←algebra.mul_smul_comm, smul_eq_mul],
end,
polar_add_right' := λ x y y', by simp only [polar_smul, polar_add_right, smul_add],
polar_smul_right' := λ b x y, begin
simp only [polar_smul, polar_smul_right, ←algebra.mul_smul_comm, smul_eq_mul],
end } ⟩
@[simp] lemma coe_fn_smul (a : S) (Q : quadratic_form R M) : ⇑(a • Q) = a • Q := rfl
@[simp] lemma smul_apply (a : S) (Q : quadratic_form R M) (x : M) :
(a • Q) x = a • Q x := rfl
instance : module S (quadratic_form R M) :=
{ mul_smul := λ a b Q, ext (λ x, by
simp only [smul_apply, mul_left_comm, ←smul_eq_mul, smul_assoc]),
one_smul := λ Q, ext (λ x, by simp),
smul_add := λ a Q Q', by { ext, simp only [add_apply, smul_apply, smul_add] },
smul_zero := λ a, by { ext, simp only [zero_apply, smul_apply, smul_zero] },
zero_smul := λ Q, by { ext, simp only [zero_apply, smul_apply, zero_smul] },
add_smul := λ a b Q, by { ext, simp only [add_apply, smul_apply, add_smul] } }
end has_scalar
section comp
variables {N : Type v} [add_comm_group N] [module R N]
/-- Compose the quadratic form with a linear function. -/
def comp (Q : quadratic_form R N) (f : M →ₗ[R] N) :
quadratic_form R M :=
{ to_fun := λ x, Q (f x),
to_fun_smul := λ a x, by simp only [map_smul, f.map_smul],
polar_add_left' := λ x x' y,
by convert polar_add_left (f x) (f x') (f y) using 1;
simp only [polar, f.map_add],
polar_smul_left' := λ a x y,
by convert polar_smul_left a (f x) (f y) using 1;
simp only [polar, f.map_smul, f.map_add, smul_eq_mul],
polar_add_right' := λ x y y',
by convert polar_add_right (f x) (f y) (f y') using 1;
simp only [polar, f.map_add],
polar_smul_right' := λ a x y,
by convert polar_smul_right a (f x) (f y) using 1;
simp only [polar, f.map_smul, f.map_add, smul_eq_mul] }
@[simp] lemma comp_apply (Q : quadratic_form R N) (f : M →ₗ[R] N) (x : M) :
(Q.comp f) x = Q (f x) := rfl
end comp
section comm_ring
/-- Create a quadratic form in a commutative ring by proving only one side of the bilinearity. -/
def mk_left (f : M → R₁)
(to_fun_smul : ∀ a x, f (a • x) = a * a * f x)
(polar_add_left : ∀ x x' y, polar f (x + x') y = polar f x y + polar f x' y)
(polar_smul_left : ∀ a x y, polar f (a • x) y = a * polar f x y) :
quadratic_form R₁ M :=
{ to_fun := f,
to_fun_smul := to_fun_smul,
polar_add_left' := polar_add_left,
polar_smul_left' := polar_smul_left,
polar_add_right' :=
λ x y y', by rw [polar_comm, polar_add_left, polar_comm f y x, polar_comm f y' x],
polar_smul_right' :=
λ a x y, by rw [polar_comm, polar_smul_left, polar_comm f y x, smul_eq_mul] }
/-- The product of linear forms is a quadratic form. -/
def lin_mul_lin (f g : M →ₗ[R₁] R₁) : quadratic_form R₁ M :=
mk_left (f * g)
(λ a x, by { simp, ring })
(λ x x' y, by { simp [polar], ring })
(λ a x y, by { simp [polar], ring })
@[simp]
lemma lin_mul_lin_apply (f g : M →ₗ[R₁] R₁) (x) : lin_mul_lin f g x = f x * g x := rfl
@[simp]
lemma add_lin_mul_lin (f g h : M →ₗ[R₁] R₁) :
lin_mul_lin (f + g) h = lin_mul_lin f h + lin_mul_lin g h :=
ext (λ x, add_mul _ _ _)
@[simp]
lemma lin_mul_lin_add (f g h : M →ₗ[R₁] R₁) :
lin_mul_lin f (g + h) = lin_mul_lin f g + lin_mul_lin f h :=
ext (λ x, mul_add _ _ _)
variables {N : Type v} [add_comm_group N] [module R₁ N]
@[simp]
lemma lin_mul_lin_comp (f g : M →ₗ[R₁] R₁) (h : N →ₗ[R₁] M) :
(lin_mul_lin f g).comp h = lin_mul_lin (f.comp h) (g.comp h) :=
rfl
variables {n : Type*}
/-- `proj i j` is the quadratic form mapping the vector `x : n → R₁` to `x i * x j` -/
def proj (i j : n) : quadratic_form R₁ (n → R₁) :=
lin_mul_lin (@linear_map.proj _ _ _ (λ _, R₁) _ _ i) (@linear_map.proj _ _ _ (λ _, R₁) _ _ j)
@[simp]
lemma proj_apply (i j : n) (x : n → R₁) : proj i j x = x i * x j := rfl
end comm_ring
end quadratic_form
/-!
### Associated bilinear forms
Over a commutative ring with an inverse of 2, the theory of quadratic forms is
basically identical to that of symmetric bilinear forms. The map from quadratic
forms to bilinear forms giving this identification is called the `associated`
quadratic form.
-/
variables {B : bilin_form R M}
namespace bilin_form
open quadratic_form
lemma polar_to_quadratic_form (x y : M) : polar (λ x, B x x) x y = B x y + B y x :=
by simp [polar, add_left, add_right, sub_eq_add_neg _ (B y y), add_comm (B y x) _, add_assoc]
/-- A bilinear form gives a quadratic form by applying the argument twice. -/
def to_quadratic_form (B : bilin_form R M) : quadratic_form R M :=
⟨ λ x, B x x,
λ a x, by simp [smul_left, smul_right, mul_assoc],
λ x x' y, by simp [polar_to_quadratic_form, add_left, add_right, add_left_comm, add_assoc],
λ a x y, by simp [polar_to_quadratic_form, smul_left, smul_right, mul_add],
λ x y y', by simp [polar_to_quadratic_form, add_left, add_right, add_left_comm, add_assoc],
λ a x y, by simp [polar_to_quadratic_form, smul_left, smul_right, mul_add] ⟩
@[simp] lemma to_quadratic_form_apply (B : bilin_form R M) (x : M) :
B.to_quadratic_form x = B x x :=
rfl
end bilin_form
namespace quadratic_form
open bilin_form sym_bilin_form
section associated_hom
variables (S) [comm_semiring S] [algebra S R]
variables [invertible (2 : R)] {B₁ : bilin_form R M}
/-- `associated_hom` is the map that sends a quadratic form on a module `M` over `R` to its
associated symmetric bilinear form. As provided here, this has the structure of an `S`-linear map
where `S` is a commutative subring of `R`.
Over a commutative ring, use `associated`, which gives an `R`-linear map. Over a general ring with
no nontrivial distinguished commutative subring, use `associated'`, which gives an additive
homomorphism (or more precisely a `ℤ`-linear map.) -/
def associated_hom : quadratic_form R M →ₗ[S] bilin_form R M :=
{ to_fun := λ Q,
{ bilin := λ x y, ⅟2 * polar Q x y,
bilin_add_left := λ x y z, by rw [← mul_add, polar_add_left],
bilin_smul_left := λ x y z, begin
have htwo : x * ⅟2 = ⅟2 * x := (commute.one_right x).bit0_right.inv_of_right,
simp [polar_smul_left, ← mul_assoc, htwo]
end,
bilin_add_right := λ x y z, by rw [← mul_add, polar_add_right],
bilin_smul_right := λ x y z, begin
have htwo : x * ⅟2 = ⅟2 * x := (commute.one_right x).bit0_right.inv_of_right,
simp [polar_smul_left, ← mul_assoc, htwo]
end },
map_add' := λ Q Q', by { ext, simp [bilin_form.add_apply, polar_add, mul_add] },
map_smul' := λ s Q, by { ext, simp [polar_smul, algebra.mul_smul_comm] } }
variables {Q : quadratic_form R M} {S}
@[simp] lemma associated_apply (x y : M) :
associated_hom S Q x y = ⅟2 * (Q (x + y) - Q x - Q y) := rfl
lemma associated_is_sym : is_sym (associated_hom S Q) :=
λ x y, by simp only [associated_apply, add_comm, add_left_comm, sub_eq_add_neg]
@[simp] lemma associated_comp {N : Type v} [add_comm_group N] [module R N] (f : N →ₗ[R] M) :
associated_hom S (Q.comp f) = (associated_hom S Q).comp f f :=
by { ext, simp }
lemma associated_to_quadratic_form (B : bilin_form R M) (x y : M) :
associated_hom S B.to_quadratic_form x y = ⅟2 * (B x y + B y x) :=
by simp [associated_apply, ←polar_to_quadratic_form, polar]
lemma associated_left_inverse (h : is_sym B₁) :
associated_hom S (B₁.to_quadratic_form) = B₁ :=
bilin_form.ext $ λ x y,
by rw [associated_to_quadratic_form, sym h x y, ←two_mul, ←mul_assoc, inv_of_mul_self, one_mul]
lemma associated_right_inverse : (associated_hom S Q).to_quadratic_form = Q :=
quadratic_form.ext $ λ x,
calc (associated_hom S Q).to_quadratic_form x
= ⅟2 * (Q x + Q x) : by simp [map_add_self, bit0, add_mul, add_assoc]
... = Q x : by rw [← two_mul (Q x), ←mul_assoc, inv_of_mul_self, one_mul]
lemma associated_eq_self_apply (x : M) : associated_hom S Q x x = Q x :=
begin
rw [associated_apply, map_add_self],
suffices : (⅟2) * (2 * Q x) = Q x,
{ convert this,
simp only [bit0, add_mul, one_mul],
abel },
simp [← mul_assoc],
end
/-- `associated'` is the `ℤ`-linear map that sends a quadratic form on a module `M` over `R` to its
associated symmetric bilinear form. -/
abbreviation associated' : quadratic_form R M →ₗ[ℤ] bilin_form R M :=
associated_hom ℤ
/-- There exists a non-null vector with respect to any quadratic form `Q` whose associated
bilinear form is non-degenerate, i.e. there exists `x` such that `Q x ≠ 0`. -/
lemma exists_quadratic_form_neq_zero [nontrivial M]
{Q : quadratic_form R M} (hB₁ : Q.associated'.nondegenerate) :
∃ x, Q x ≠ 0 :=
begin
rw nondegenerate at hB₁,
contrapose! hB₁,
obtain ⟨x, hx⟩ := exists_ne (0 : M),
refine ⟨x, λ y, _, hx⟩,
have : Q = 0 := quadratic_form.ext hB₁,
simp [this]
end
end associated_hom
section associated
variables [invertible (2 : R₁)]
-- Note: When possible, rather than writing lemmas about `associated`, write a lemma applying to
-- the more general `associated_hom` and place it in the previous section.
/-- `associated` is the linear map that sends a quadratic form over a commutative ring to its
associated symmetric bilinear form. -/
abbreviation associated : quadratic_form R₁ M →ₗ[R₁] bilin_form R₁ M :=
associated_hom R₁
@[simp] lemma associated_lin_mul_lin (f g : M →ₗ[R₁] R₁) :
(lin_mul_lin f g).associated =
⅟(2 : R₁) • (bilin_form.lin_mul_lin f g + bilin_form.lin_mul_lin g f) :=
by { ext, simp [bilin_form.add_apply, bilin_form.smul_apply], ring }
end associated
section anisotropic
/-- An anisotropic quadratic form is zero only on zero vectors. -/
def anisotropic (Q : quadratic_form R M) : Prop := ∀ x, Q x = 0 → x = 0
lemma not_anisotropic_iff_exists (Q : quadratic_form R M) :
¬anisotropic Q ↔ ∃ x ≠ 0, Q x = 0 :=
by simp only [anisotropic, not_forall, exists_prop, and_comm]
/-- The associated bilinear form of an anisotropic quadratic form is nondegenerate. -/
lemma nondegenerate_of_anisotropic [invertible (2 : R)] (Q : quadratic_form R M)
(hB : Q.anisotropic) : Q.associated'.nondegenerate :=
begin
intros x hx,
refine hB _ _,
rw ← hx x,
exact (associated_eq_self_apply x).symm,
end
end anisotropic
section pos_def
variables {R₂ : Type u} [ordered_ring R₂] [module R₂ M] {Q₂ : quadratic_form R₂ M}
/-- A positive definite quadratic form is positive on nonzero vectors. -/
def pos_def (Q₂ : quadratic_form R₂ M) : Prop := ∀ x ≠ 0, 0 < Q₂ x
lemma pos_def.smul {R} [linear_ordered_comm_ring R] [module R M]
{Q : quadratic_form R M} (h : pos_def Q) {a : R} (a_pos : 0 < a) : pos_def (a • Q) :=
λ x hx, mul_pos a_pos (h x hx)
variables {n : Type*}
lemma pos_def.add (Q Q' : quadratic_form R₂ M) (hQ : pos_def Q) (hQ' : pos_def Q') :
pos_def (Q + Q') :=
λ x hx, add_pos (hQ x hx) (hQ' x hx)
lemma lin_mul_lin_self_pos_def {R} [linear_ordered_comm_ring R] [module R M]
(f : M →ₗ[R] R) (hf : linear_map.ker f = ⊥) :
pos_def (lin_mul_lin f f) :=
λ x hx, mul_self_pos (λ h, hx (linear_map.ker_eq_bot.mp hf (by rw [h, linear_map.map_zero])))
end pos_def
end quadratic_form
section
/-!
### Quadratic forms and matrices
Connect quadratic forms and matrices, in order to explicitly compute with them.
The convention is twos out, so there might be a factor 2⁻¹ in the entries of the
matrix.
The determinant of the matrix is the discriminant of the quadratic form.
-/
variables {n : Type w} [fintype n] [decidable_eq n]
/-- `M.to_quadratic_form` is the map `λ x, col x ⬝ M ⬝ row x` as a quadratic form. -/
def matrix.to_quadratic_form' (M : matrix n n R₁) :
quadratic_form R₁ (n → R₁) :=
M.to_bilin'.to_quadratic_form
variables [invertible (2 : R₁)]
/-- A matrix representation of the quadratic form. -/
def quadratic_form.to_matrix' (Q : quadratic_form R₁ (n → R₁)) : matrix n n R₁ :=
Q.associated.to_matrix'
open quadratic_form
lemma quadratic_form.to_matrix'_smul (a : R₁) (Q : quadratic_form R₁ (n → R₁)) :
(a • Q).to_matrix' = a • Q.to_matrix' :=
by simp only [to_matrix', linear_equiv.map_smul, linear_map.map_smul]
end
namespace quadratic_form
variables {n : Type w} [fintype n]
variables [decidable_eq n] [invertible (2 : R₁)]
variables {m : Type w} [decidable_eq m] [fintype m]
open_locale matrix
@[simp]
lemma to_matrix'_comp (Q : quadratic_form R₁ (m → R₁)) (f : (n → R₁) →ₗ[R₁] (m → R₁)) :
(Q.comp f).to_matrix' = f.to_matrix'ᵀ ⬝ Q.to_matrix' ⬝ f.to_matrix' :=
by { ext, simp [to_matrix', bilin_form.to_matrix'_comp] }
section discriminant
variables {Q : quadratic_form R₁ (n → R₁)}
/-- The discriminant of a quadratic form generalizes the discriminant of a quadratic polynomial. -/
def discr (Q : quadratic_form R₁ (n → R₁)) : R₁ := Q.to_matrix'.det
lemma discr_smul (a : R₁) : (a • Q).discr = a ^ fintype.card n * Q.discr :=
by simp only [discr, to_matrix'_smul, matrix.det_smul]
lemma discr_comp (f : (n → R₁) →ₗ[R₁] (n → R₁)) :
(Q.comp f).discr = f.to_matrix'.det * f.to_matrix'.det * Q.discr :=
by simp [discr, mul_left_comm, mul_comm]
end discriminant
end quadratic_form
namespace quadratic_form
variables {M₁ : Type*} {M₂ : Type*} {M₃ : Type*}
variables [add_comm_group M₁] [add_comm_group M₂] [add_comm_group M₃]
variables [module R M₁] [module R M₂] [module R M₃]
/-- An isometry between two quadratic spaces `M₁, Q₁` and `M₂, Q₂` over a ring `R`,
is a linear equivalence between `M₁` and `M₂` that commutes with the quadratic forms. -/
@[nolint has_inhabited_instance] structure isometry
(Q₁ : quadratic_form R M₁) (Q₂ : quadratic_form R M₂) extends M₁ ≃ₗ[R] M₂ :=
(map_app' : ∀ m, Q₂ (to_fun m) = Q₁ m)
/-- Two quadratic forms over a ring `R` are equivalent
if there exists an isometry between them:
a linear equivalence that transforms one quadratic form into the other. -/
def equivalent (Q₁ : quadratic_form R M₁) (Q₂ : quadratic_form R M₂) := nonempty (Q₁.isometry Q₂)
namespace isometry
variables {Q₁ : quadratic_form R M₁} {Q₂ : quadratic_form R M₂} {Q₃ : quadratic_form R M₃}
instance : has_coe (Q₁.isometry Q₂) (M₁ ≃ₗ[R] M₂) := ⟨isometry.to_linear_equiv⟩
instance : has_coe_to_fun (Q₁.isometry Q₂) :=
{ F := λ _, M₁ → M₂, coe := λ f, ⇑(f : M₁ ≃ₗ[R] M₂) }
@[simp] lemma map_app (f : Q₁.isometry Q₂) (m : M₁) : Q₂ (f m) = Q₁ m := f.map_app' m
/-- The identity isometry from a quadratic form to itself. -/
@[refl]
def refl (Q : quadratic_form R M) : Q.isometry Q :=
{ map_app' := λ m, rfl,
.. linear_equiv.refl R M }
/-- The inverse isometry of an isometry between two quadratic forms. -/
@[symm]
def symm (f : Q₁.isometry Q₂) : Q₂.isometry Q₁ :=
{ map_app' := by { intro m, rw ← f.map_app, congr, exact f.to_linear_equiv.apply_symm_apply m },
.. (f : M₁ ≃ₗ[R] M₂).symm }
/-- The composition of two isometries between quadratic forms. -/
@[trans]
def trans (f : Q₁.isometry Q₂) (g : Q₂.isometry Q₃) : Q₁.isometry Q₃ :=
{ map_app' := by { intro m, rw [← f.map_app, ← g.map_app], refl },
.. (f : M₁ ≃ₗ[R] M₂).trans (g : M₂ ≃ₗ[R] M₃) }
end isometry
namespace equivalent
variables {Q₁ : quadratic_form R M₁} {Q₂ : quadratic_form R M₂} {Q₃ : quadratic_form R M₃}
@[refl]
lemma refl (Q : quadratic_form R M) : Q.equivalent Q := ⟨isometry.refl Q⟩
@[symm]
lemma symm (h : Q₁.equivalent Q₂) : Q₂.equivalent Q₁ := h.elim $ λ f, ⟨f.symm⟩
@[trans]
lemma trans (h : Q₁.equivalent Q₂) (h' : Q₂.equivalent Q₃) : Q₁.equivalent Q₃ :=
h'.elim $ h.elim $ λ f g, ⟨f.trans g⟩
end equivalent
end quadratic_form
namespace bilin_form
/-- A bilinear form is nondegenerate if the quadratic form it is associated with is anisotropic. -/
lemma nondegenerate_of_anisotropic
{B : bilin_form R M} (hB : B.to_quadratic_form.anisotropic) : B.nondegenerate :=
λ x hx, hB _ (hx x)
/-- There exists a non-null vector with respect to any symmetric, nondegenerate bilinear form `B`
on a nontrivial module `M` over a ring `R` with invertible `2`, i.e. there exists some
`x : M` such that `B x x ≠ 0`. -/
lemma exists_bilin_form_self_neq_zero [htwo : invertible (2 : R)] [nontrivial M]
{B : bilin_form R M} (hB₁ : B.nondegenerate) (hB₂ : sym_bilin_form.is_sym B) :
∃ x, ¬ B.is_ortho x x :=
begin
have : B.to_quadratic_form.associated'.nondegenerate,
{ simpa [quadratic_form.associated_left_inverse hB₂] using hB₁ },
obtain ⟨x, hx⟩ := quadratic_form.exists_quadratic_form_neq_zero this,
refine ⟨x, λ h, hx (B.to_quadratic_form_apply x ▸ h)⟩,
end
open finite_dimensional
variables {V : Type u} {K : Type v} [field K] [add_comm_group V] [module K V]
variable [finite_dimensional K V]
-- We start proving that symmetric nondegenerate bilinear forms are diagonalisable, or equivalently
-- there exists a orthogonal basis with respect to any symmetric nondegenerate bilinear form.
lemma exists_orthogonal_basis' [hK : invertible (2 : K)]
{B : bilin_form K V} (hB₁ : B.nondegenerate) (hB₂ : sym_bilin_form.is_sym B) :
∃ v : fin (finrank K V) → V,
B.is_Ortho v ∧ is_basis K v ∧ ∀ i, B (v i) (v i) ≠ 0 :=
begin
tactic.unfreeze_local_instances,
induction hd : finrank K V with d ih generalizing V,
{ exact ⟨λ _, 0, λ _ _ _, zero_left _, is_basis_of_finrank_zero' hd, fin.elim0⟩ },
{ haveI := finrank_pos_iff.1 (hd.symm ▸ nat.succ_pos d : 0 < finrank K V),
cases exists_bilin_form_self_neq_zero hB₁ hB₂ with x hx,
{ have hd' := hd,
rw [← submodule.finrank_add_eq_of_is_compl
(is_compl_span_singleton_orthogonal hx).symm,
finrank_span_singleton (ne_zero_of_not_is_ortho_self x hx)] at hd,
rcases @ih (B.orthogonal $ K ∙ x) _ _ _
(B.restrict _) (B.restrict_orthogonal_span_singleton_nondegenerate hB₁ hB₂ hx)
(B.restrict_sym hB₂ _) (nat.succ.inj hd) with ⟨v', hv₁, hv₂, hv₃⟩,
refine ⟨λ i, if h : i ≠ 0 then coe (v' (i.pred h)) else x, λ i j hij, _, _, _⟩,
{ by_cases hi : i = 0,
{ subst i,
simp only [eq_self_iff_true, not_true, ne.def, dif_neg,
not_false_iff, dite_not],
rw [dif_neg hij.symm, is_ortho, hB₂],
exact (v' (j.pred hij.symm)).2 _ (submodule.mem_span_singleton_self x) },
by_cases hj : j = 0,
{ subst j,
simp only [eq_self_iff_true, not_true, ne.def, dif_neg,
not_false_iff, dite_not],
rw dif_neg hi,
exact (v' (i.pred hi)).2 _ (submodule.mem_span_singleton_self x) },
{ simp_rw [dif_pos hi, dif_pos hj],
rw [is_ortho, hB₂],
exact hv₁ (j.pred hj) (i.pred hi) (by simpa using hij.symm) } },
{ refine is_basis_of_linear_independent_of_card_eq_finrank
(@linear_independent_of_is_Ortho _ _ _ _ _ _ B _ _ _)
(by rw [hd', fintype.card_fin]),
{ intros i j hij,
by_cases hi : i = 0,
{ subst hi,
simp only [eq_self_iff_true, not_true, ne.def, dif_neg,
not_false_iff, dite_not],
rw [dif_neg hij.symm, is_ortho, hB₂],
exact (v' (j.pred hij.symm)).2 _ (submodule.mem_span_singleton_self x) },
by_cases hj : j = 0,
{ subst j,
simp only [eq_self_iff_true, not_true, ne.def, dif_neg,
not_false_iff, dite_not],
rw dif_neg hi,
exact (v' (i.pred hi)).2 _ (submodule.mem_span_singleton_self x) },
{ simp_rw [dif_pos hi, dif_pos hj],
rw [is_ortho, hB₂],
exact hv₁ (j.pred hj) (i.pred hi) (by simpa using hij.symm) } },
{ intro i,
by_cases hi : i ≠ 0,
{ rw dif_pos hi,
exact hv₃ (i.pred hi) },
{ rw dif_neg hi, exact hx } } },
{ intro i,
by_cases hi : i ≠ 0,
{ rw dif_pos hi,
exact hv₃ (i.pred hi) },
{ rw dif_neg hi, exact hx } } } }
end .
/-- Given a nondegenerate symmetric bilinear form `B` on some vector space `V` over the
field `K` with invertible `2`, there exists an orthogonal basis with respect to `B`. -/
theorem exists_orthogonal_basis [hK : invertible (2 : K)]
{B : bilin_form K V} (hB₁ : B.nondegenerate) (hB₂ : sym_bilin_form.is_sym B) :
∃ v : fin (finrank K V) → V, B.is_Ortho v ∧ is_basis K v :=
let ⟨v, hv₁, hv₂, _⟩ := exists_orthogonal_basis' hB₁ hB₂ in ⟨v, hv₁, hv₂⟩
end bilin_form
|
[STATEMENT]
lemma semantic_correctness0:
fixes exp
assumes "cupcake_evaluate_single env exp r" "is_cupcake_all_env env"
assumes "fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))"
assumes "related_exp t exp"
assumes "wellformed t" "wellformed_venv \<Gamma>"
assumes "closed_venv \<Gamma>" "closed_except t (fmdom \<Gamma>)"
assumes "fmpred (\<lambda>_. vwelldefined') \<Gamma>" "consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C"
assumes "fdisjnt C (fmdom \<Gamma>)"
assumes "\<not> shadows_consts t" "not_shadows_vconsts_env \<Gamma>"
shows "if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) r
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
cupcake_evaluate_single env exp r
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t exp
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
goal (1 subgoal):
1. if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) r
[PROOF STEP]
proof (induction arbitrary: \<Gamma> t)
[PROOF STATE]
proof (state)
goal (12 subgoals):
1. \<And>env cn es rs vs v0 \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; build_conv (sem_env.c env) cn (rev vs) = Some v0; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0)
2. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
3. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
4. \<And>env n v0 \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = Some v0; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0)
5. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env n e \<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Fun n e); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval (Closure env n e))
7. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
9. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
10. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
A total of 12 subgoals...
[PROOF STEP]
case (con1 env cn es ress ml_vs ml_v')
[PROOF STATE]
proof (state)
this:
do_con_check (sem_env.c env) cn (length es)
sequence_result ress = Rval ml_vs
build_conv (sem_env.c env) cn (rev ml_vs) = Some ml_v'
list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) ress
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (Con cn es)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
goal (12 subgoals):
1. \<And>env cn es rs vs v0 \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; build_conv (sem_env.c env) cn (rev vs) = Some v0; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0)
2. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
3. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
4. \<And>env n v0 \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = Some v0; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0)
5. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env n e \<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Fun n e); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval (Closure env n e))
7. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
9. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
10. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
A total of 12 subgoals...
[PROOF STEP]
obtain name ts where "cn = Some (Short (as_string name))" "name |\<in>| C" "t = name $$ ts" "list_all2 related_exp ts es"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<And>name ts. \<lbrakk>cn = Some (Short (as_string name)); name |\<in>| C; t = name $$ ts; list_all2 related_exp ts es\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>related_exp t (Con cn es)\<close>
[PROOF STATE]
proof (prove)
using this:
related_exp t (Con cn es)
goal (1 subgoal):
1. (\<And>name ts. \<lbrakk>cn = Some (Short (as_string name)); name |\<in>| C; t = name $$ ts; list_all2 related_exp ts es\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by cases auto
[PROOF STATE]
proof (state)
this:
cn = Some (Short (as_string name))
name |\<in>| C
t = name $$ ts
list_all2 related_exp ts es
goal (12 subgoals):
1. \<And>env cn es rs vs v0 \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; build_conv (sem_env.c env) cn (rev vs) = Some v0; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0)
2. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
3. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
4. \<And>env n v0 \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = Some v0; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0)
5. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env n e \<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Fun n e); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval (Closure env n e))
7. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
9. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
10. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
A total of 12 subgoals...
[PROOF STEP]
with con1
[PROOF STATE]
proof (chain)
picking this:
do_con_check (sem_env.c env) cn (length es)
sequence_result ress = Rval ml_vs
build_conv (sem_env.c env) cn (rev ml_vs) = Some ml_v'
list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) ress
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (Con cn es)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
cn = Some (Short (as_string name))
name |\<in>| C
t = name $$ ts
list_all2 related_exp ts es
[PROOF STEP]
obtain tid where "ml_v' = Conv (Some (id_to_n (Short (as_string name)), tid)) (rev ml_vs)"
[PROOF STATE]
proof (prove)
using this:
do_con_check (sem_env.c env) cn (length es)
sequence_result ress = Rval ml_vs
build_conv (sem_env.c env) cn (rev ml_vs) = Some ml_v'
list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) ress
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (Con cn es)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
cn = Some (Short (as_string name))
name |\<in>| C
t = name $$ ts
list_all2 related_exp ts es
goal (1 subgoal):
1. (\<And>tid. ml_v' = Conv (Some (id_to_n (Short (as_string name)), tid)) (rev ml_vs) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto split: option.splits)
[PROOF STATE]
proof (state)
this:
ml_v' = Conv (Some (id_to_n (Short (as_string name)), tid)) (rev ml_vs)
goal (12 subgoals):
1. \<And>env cn es rs vs v0 \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; build_conv (sem_env.c env) cn (rev vs) = Some v0; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0)
2. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
3. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
4. \<And>env n v0 \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = Some v0; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0)
5. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env n e \<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Fun n e); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval (Closure env n e))
7. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
9. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
10. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
A total of 12 subgoals...
[PROOF STEP]
have "ress = map Rval ml_vs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. ress = map Rval ml_vs
[PROOF STEP]
using con1
[PROOF STATE]
proof (prove)
using this:
do_con_check (sem_env.c env) cn (length es)
sequence_result ress = Rval ml_vs
build_conv (sem_env.c env) cn (rev ml_vs) = Some ml_v'
list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) ress
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (Con cn es)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
goal (1 subgoal):
1. ress = map Rval ml_vs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ress = map Rval ml_vs
goal (12 subgoals):
1. \<And>env cn es rs vs v0 \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; build_conv (sem_env.c env) cn (rev vs) = Some v0; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0)
2. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
3. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
4. \<And>env n v0 \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = Some v0; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0)
5. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env n e \<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Fun n e); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval (Closure env n e))
7. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
9. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
10. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
A total of 12 subgoals...
[PROOF STEP]
define ml_vs' where "ml_vs' = rev ml_vs"
[PROOF STATE]
proof (state)
this:
ml_vs' = rev ml_vs
goal (12 subgoals):
1. \<And>env cn es rs vs v0 \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; build_conv (sem_env.c env) cn (rev vs) = Some v0; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0)
2. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
3. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
4. \<And>env n v0 \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = Some v0; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0)
5. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env n e \<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Fun n e); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval (Closure env n e))
7. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
9. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
10. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
A total of 12 subgoals...
[PROOF STEP]
note IH = \<open>list_all2_shortcircuit _ _ _\<close>[
unfolded \<open>ress = _\<close> list_all2_shortcircuit_rval list_all2_rev1,
folded ml_vs'_def]
[PROOF STATE]
proof (state)
this:
list_all2 (\<lambda>x y. cupcake_evaluate_single env x (Rval y) \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>xa xb. fmrel_on_fset (ids xb) related_v xa (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xb x \<longrightarrow> pre_strong_term_class.wellformed xb \<longrightarrow> wellformed_venv xa \<longrightarrow> closed_venv xa \<longrightarrow> closed_except xb (fmdom xa) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') xa \<longrightarrow> consts xb |\<subseteq>| fmdom xa |\<union>| C \<longrightarrow> fdisjnt C (fmdom xa) \<longrightarrow> \<not> shadows_consts xb \<longrightarrow> not_shadows_vconsts_env xa \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. xa \<turnstile>\<^sub>v xb \<down> v \<and> related_v v ml_v) (Rval y)))) es ml_vs'
goal (12 subgoals):
1. \<And>env cn es rs vs v0 \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; build_conv (sem_env.c env) cn (rev vs) = Some v0; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0)
2. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
3. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
4. \<And>env n v0 \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = Some v0; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0)
5. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env n e \<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Fun n e); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval (Closure env n e))
7. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
9. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
10. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
A total of 12 subgoals...
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
list_all2 (\<lambda>x y. cupcake_evaluate_single env x (Rval y) \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>xa xb. fmrel_on_fset (ids xb) related_v xa (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xb x \<longrightarrow> pre_strong_term_class.wellformed xb \<longrightarrow> wellformed_venv xa \<longrightarrow> closed_venv xa \<longrightarrow> closed_except xb (fmdom xa) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') xa \<longrightarrow> consts xb |\<subseteq>| fmdom xa |\<union>| C \<longrightarrow> fdisjnt C (fmdom xa) \<longrightarrow> \<not> shadows_consts xb \<longrightarrow> not_shadows_vconsts_env xa \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. xa \<turnstile>\<^sub>v xb \<down> v \<and> related_v v ml_v) (Rval y)))) es ml_vs'
goal (12 subgoals):
1. \<And>env cn es rs vs v0 \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; build_conv (sem_env.c env) cn (rev vs) = Some v0; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0)
2. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
3. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
4. \<And>env n v0 \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = Some v0; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0)
5. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env n e \<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Fun n e); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval (Closure env n e))
7. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
9. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
10. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
A total of 12 subgoals...
[PROOF STEP]
have
"list_all wellformed ts" "list_all (\<lambda>t. \<not> shadows_consts t) ts"
"list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts" "list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (list_all pre_strong_term_class.wellformed ts &&& list_all (\<lambda>t. \<not> shadows_consts t) ts) &&& list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts &&& list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. list_all pre_strong_term_class.wellformed ts
[PROOF STEP]
using \<open>wellformed t\<close>
[PROOF STATE]
proof (prove)
using this:
pre_strong_term_class.wellformed t
goal (1 subgoal):
1. list_all pre_strong_term_class.wellformed ts
[PROOF STEP]
unfolding \<open>t = _\<close> wellformed.list_comb
[PROOF STATE]
proof (prove)
using this:
pre_strong_term_class.wellformed (const name) \<and> list_all pre_strong_term_class.wellformed ts
goal (1 subgoal):
1. list_all pre_strong_term_class.wellformed ts
[PROOF STEP]
by simp
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. list_all (\<lambda>t. \<not> shadows_consts t) ts
2. list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts
3. list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. list_all (\<lambda>t. \<not> shadows_consts t) ts
[PROOF STEP]
using \<open>\<not> shadows_consts t\<close>
[PROOF STATE]
proof (prove)
using this:
\<not> shadows_consts t
goal (1 subgoal):
1. list_all (\<lambda>t. \<not> shadows_consts t) ts
[PROOF STEP]
unfolding \<open>t = _\<close> shadows.list_comb
[PROOF STATE]
proof (prove)
using this:
\<not> (shadows_consts (const name) \<or> list_ex shadows_consts ts)
goal (1 subgoal):
1. list_all (\<lambda>t. \<not> shadows_consts t) ts
[PROOF STEP]
by (simp add: list_all_iff list_ex_iff)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts
2. list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts
[PROOF STEP]
using \<open>consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C\<close>
[PROOF STATE]
proof (prove)
using this:
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
goal (1 subgoal):
1. list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts
[PROOF STEP]
unfolding list_all_iff
[PROOF STATE]
proof (prove)
using this:
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
goal (1 subgoal):
1. \<forall>t\<in>set ts. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
[PROOF STEP]
by (metis Ball_set \<open>t = name $$ ts\<close> con1.prems(9) special_constants.sconsts_list_comb)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts
[PROOF STEP]
using \<open>closed_except t (fmdom \<Gamma>)\<close>
[PROOF STATE]
proof (prove)
using this:
closed_except t (fmdom \<Gamma>)
goal (1 subgoal):
1. list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts
[PROOF STEP]
unfolding \<open>t = _\<close> closed.list_comb
[PROOF STATE]
proof (prove)
using this:
closed_except (const name) (fmdom \<Gamma>) \<and> list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts
goal (1 subgoal):
1. list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts
[PROOF STEP]
by simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
list_all pre_strong_term_class.wellformed ts
list_all (\<lambda>t. \<not> shadows_consts t) ts
list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts
list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts
goal (12 subgoals):
1. \<And>env cn es rs vs v0 \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; build_conv (sem_env.c env) cn (rev vs) = Some v0; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0)
2. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
3. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
4. \<And>env n v0 \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = Some v0; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0)
5. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env n e \<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Fun n e); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval (Closure env n e))
7. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
9. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
10. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
A total of 12 subgoals...
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
list_all pre_strong_term_class.wellformed ts
list_all (\<lambda>t. \<not> shadows_consts t) ts
list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts
list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts
goal (12 subgoals):
1. \<And>env cn es rs vs v0 \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; build_conv (sem_env.c env) cn (rev vs) = Some v0; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0)
2. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
3. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
4. \<And>env n v0 \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = Some v0; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0)
5. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env n e \<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Fun n e); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval (Closure env n e))
7. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
9. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
10. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
A total of 12 subgoals...
[PROOF STEP]
have
"list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts
[PROOF STEP]
proof (standard, rule fmrel_on_fsubset)
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. \<And>x. x \<in> set ts \<Longrightarrow> fmrel_on_fset (?S2 x) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
2. \<And>x. x \<in> set ts \<Longrightarrow> ids x |\<subseteq>| ?S2 x
[PROOF STEP]
fix t'
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. \<And>x. x \<in> set ts \<Longrightarrow> fmrel_on_fset (?S2 x) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
2. \<And>x. x \<in> set ts \<Longrightarrow> ids x |\<subseteq>| ?S2 x
[PROOF STEP]
assume "t' \<in> set ts"
[PROOF STATE]
proof (state)
this:
t' \<in> set ts
goal (2 subgoals):
1. \<And>x. x \<in> set ts \<Longrightarrow> fmrel_on_fset (?S2 x) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
2. \<And>x. x \<in> set ts \<Longrightarrow> ids x |\<subseteq>| ?S2 x
[PROOF STEP]
thus "ids t' |\<subseteq>| ids t"
[PROOF STATE]
proof (prove)
using this:
t' \<in> set ts
goal (1 subgoal):
1. ids t' |\<subseteq>| ids t
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
using this:
t' \<in> set ts
goal (1 subgoal):
1. ids t' |\<subseteq>| ids (name $$ ts)
[PROOF STEP]
apply (simp add: ids_list_comb)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. t' \<in> set ts \<Longrightarrow> ids t' |\<subseteq>| ids (const name) |\<union>| ffUnion (ids |`| fset_of_list ts)
[PROOF STEP]
apply (subst (2) ids_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. t' \<in> set ts \<Longrightarrow> ids t' |\<subseteq>| frees (const name) |\<union>| consts (const name) |\<union>| ffUnion (ids |`| fset_of_list ts)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. t' \<in> set ts \<Longrightarrow> ids t' |\<subseteq>| finsert name (ffUnion (ids |`| fset_of_list ts))
[PROOF STEP]
apply (rule fsubset_finsertI2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. t' \<in> set ts \<Longrightarrow> ids t' |\<subseteq>| ffUnion (ids |`| fset_of_list ts)
[PROOF STEP]
apply (auto simp: fset_of_list_elem intro!: ffUnion_subset_elem)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
ids t' |\<subseteq>| ids t
goal (1 subgoal):
1. \<And>x. x \<in> set ts \<Longrightarrow> fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
[PROOF STEP]
show "fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts
goal (12 subgoals):
1. \<And>env cn es rs vs v0 \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; build_conv (sem_env.c env) cn (rev vs) = Some v0; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0)
2. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
3. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
4. \<And>env n v0 \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = Some v0; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0)
5. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env n e \<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Fun n e); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval (Closure env n e))
7. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
9. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
10. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
A total of 12 subgoals...
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
list_all2 (\<lambda>x y. cupcake_evaluate_single env x (Rval y) \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>xa xb. fmrel_on_fset (ids xb) related_v xa (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xb x \<longrightarrow> pre_strong_term_class.wellformed xb \<longrightarrow> wellformed_venv xa \<longrightarrow> closed_venv xa \<longrightarrow> closed_except xb (fmdom xa) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') xa \<longrightarrow> consts xb |\<subseteq>| fmdom xa |\<union>| C \<longrightarrow> fdisjnt C (fmdom xa) \<longrightarrow> \<not> shadows_consts xb \<longrightarrow> not_shadows_vconsts_env xa \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. xa \<turnstile>\<^sub>v xb \<down> v \<and> related_v v ml_v) (Rval y)))) es ml_vs'
list_all pre_strong_term_class.wellformed ts
list_all (\<lambda>t. \<not> shadows_consts t) ts
list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts
list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts
list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts
[PROOF STEP]
obtain us where "list_all2 (veval' \<Gamma>) ts us" "list_all2 related_v us ml_vs'"
[PROOF STATE]
proof (prove)
using this:
list_all2 (\<lambda>x y. cupcake_evaluate_single env x (Rval y) \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>xa xb. fmrel_on_fset (ids xb) related_v xa (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xb x \<longrightarrow> pre_strong_term_class.wellformed xb \<longrightarrow> wellformed_venv xa \<longrightarrow> closed_venv xa \<longrightarrow> closed_except xb (fmdom xa) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') xa \<longrightarrow> consts xb |\<subseteq>| fmdom xa |\<union>| C \<longrightarrow> fdisjnt C (fmdom xa) \<longrightarrow> \<not> shadows_consts xb \<longrightarrow> not_shadows_vconsts_env xa \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. xa \<turnstile>\<^sub>v xb \<down> v \<and> related_v v ml_v) (Rval y)))) es ml_vs'
list_all pre_strong_term_class.wellformed ts
list_all (\<lambda>t. \<not> shadows_consts t) ts
list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts
list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts
list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts
goal (1 subgoal):
1. (\<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ts us; list_all2 related_v us ml_vs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>list_all2 related_exp ts es\<close>
[PROOF STATE]
proof (prove)
using this:
list_all2 (\<lambda>x y. cupcake_evaluate_single env x (Rval y) \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>xa xb. fmrel_on_fset (ids xb) related_v xa (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xb x \<longrightarrow> pre_strong_term_class.wellformed xb \<longrightarrow> wellformed_venv xa \<longrightarrow> closed_venv xa \<longrightarrow> closed_except xb (fmdom xa) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') xa \<longrightarrow> consts xb |\<subseteq>| fmdom xa |\<union>| C \<longrightarrow> fdisjnt C (fmdom xa) \<longrightarrow> \<not> shadows_consts xb \<longrightarrow> not_shadows_vconsts_env xa \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. xa \<turnstile>\<^sub>v xb \<down> v \<and> related_v v ml_v) (Rval y)))) es ml_vs'
list_all pre_strong_term_class.wellformed ts
list_all (\<lambda>t. \<not> shadows_consts t) ts
list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts
list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts
list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts
list_all2 related_exp ts es
goal (1 subgoal):
1. (\<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ts us; list_all2 related_v us ml_vs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof (induction es ml_vs' arbitrary: ts thesis rule: list.rel_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. \<And>ts thesis. \<lbrakk>\<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ts us; list_all2 related_v us []\<rbrakk> \<Longrightarrow> thesis; list_all pre_strong_term_class.wellformed ts; list_all (\<lambda>t. \<not> shadows_consts t) ts; list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts; list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts; list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts; list_all2 related_exp ts []\<rbrakk> \<Longrightarrow> thesis
2. \<And>a21 a22 b21 b22 ts thesis. \<lbrakk>cupcake_evaluate_single env a21 (Rval b21) \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa a21 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) (Rval b21))); \<And>ts thesis. \<lbrakk>\<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ts us; list_all2 related_v us b22\<rbrakk> \<Longrightarrow> thesis; list_all pre_strong_term_class.wellformed ts; list_all (\<lambda>t. \<not> shadows_consts t) ts; list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts; list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts; list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts; list_all2 related_exp ts a22\<rbrakk> \<Longrightarrow> thesis; \<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ts us; list_all2 related_v us (b21 # b22)\<rbrakk> \<Longrightarrow> thesis; list_all pre_strong_term_class.wellformed ts; list_all (\<lambda>t. \<not> shadows_consts t) ts; list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts; list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts; list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts; list_all2 related_exp ts (a21 # a22)\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
case (Cons e es ml_v ml_vs ts0)
[PROOF STATE]
proof (state)
this:
cupcake_evaluate_single env e (Rval ml_v) \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa e \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) (Rval ml_v)))
\<lbrakk>\<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ?ts6 us; list_all2 related_v us ml_vs\<rbrakk> \<Longrightarrow> ?thesis6; list_all pre_strong_term_class.wellformed ?ts6; list_all (\<lambda>t. \<not> shadows_consts t) ?ts6; list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ?ts6; list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ?ts6; list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ?ts6; list_all2 related_exp ?ts6 es\<rbrakk> \<Longrightarrow> ?thesis6
\<lbrakk>list_all2 (veval' \<Gamma>) ts0 ?us6; list_all2 related_v ?us6 (ml_v # ml_vs)\<rbrakk> \<Longrightarrow> thesis
list_all pre_strong_term_class.wellformed ts0
list_all (\<lambda>t. \<not> shadows_consts t) ts0
list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts0
list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts0
list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts0
list_all2 related_exp ts0 (e # es)
goal (2 subgoals):
1. \<And>ts thesis. \<lbrakk>\<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ts us; list_all2 related_v us []\<rbrakk> \<Longrightarrow> thesis; list_all pre_strong_term_class.wellformed ts; list_all (\<lambda>t. \<not> shadows_consts t) ts; list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts; list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts; list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts; list_all2 related_exp ts []\<rbrakk> \<Longrightarrow> thesis
2. \<And>a21 a22 b21 b22 ts thesis. \<lbrakk>cupcake_evaluate_single env a21 (Rval b21) \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa a21 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) (Rval b21))); \<And>ts thesis. \<lbrakk>\<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ts us; list_all2 related_v us b22\<rbrakk> \<Longrightarrow> thesis; list_all pre_strong_term_class.wellformed ts; list_all (\<lambda>t. \<not> shadows_consts t) ts; list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts; list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts; list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts; list_all2 related_exp ts a22\<rbrakk> \<Longrightarrow> thesis; \<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ts us; list_all2 related_v us (b21 # b22)\<rbrakk> \<Longrightarrow> thesis; list_all pre_strong_term_class.wellformed ts; list_all (\<lambda>t. \<not> shadows_consts t) ts; list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts; list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts; list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts; list_all2 related_exp ts (a21 # a22)\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cupcake_evaluate_single env e (Rval ml_v) \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa e \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) (Rval ml_v)))
\<lbrakk>\<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ?ts6 us; list_all2 related_v us ml_vs\<rbrakk> \<Longrightarrow> ?thesis6; list_all pre_strong_term_class.wellformed ?ts6; list_all (\<lambda>t. \<not> shadows_consts t) ?ts6; list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ?ts6; list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ?ts6; list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ?ts6; list_all2 related_exp ?ts6 es\<rbrakk> \<Longrightarrow> ?thesis6
\<lbrakk>list_all2 (veval' \<Gamma>) ts0 ?us6; list_all2 related_v ?us6 (ml_v # ml_vs)\<rbrakk> \<Longrightarrow> thesis
list_all pre_strong_term_class.wellformed ts0
list_all (\<lambda>t. \<not> shadows_consts t) ts0
list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts0
list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts0
list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts0
list_all2 related_exp ts0 (e # es)
[PROOF STEP]
obtain t ts where "ts0 = t # ts" "related_exp t e"
[PROOF STATE]
proof (prove)
using this:
cupcake_evaluate_single env e (Rval ml_v) \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa e \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) (Rval ml_v)))
\<lbrakk>\<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ?ts6 us; list_all2 related_v us ml_vs\<rbrakk> \<Longrightarrow> ?thesis6; list_all pre_strong_term_class.wellformed ?ts6; list_all (\<lambda>t. \<not> shadows_consts t) ?ts6; list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ?ts6; list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ?ts6; list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ?ts6; list_all2 related_exp ?ts6 es\<rbrakk> \<Longrightarrow> ?thesis6
\<lbrakk>list_all2 (veval' \<Gamma>) ts0 ?us6; list_all2 related_v ?us6 (ml_v # ml_vs)\<rbrakk> \<Longrightarrow> thesisa__
list_all pre_strong_term_class.wellformed ts0
list_all (\<lambda>t. \<not> shadows_consts t) ts0
list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts0
list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts0
list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts0
list_all2 related_exp ts0 (e # es)
goal (1 subgoal):
1. (\<And>t ts. \<lbrakk>ts0 = t # ts; related_exp t e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases ts0) auto
[PROOF STATE]
proof (state)
this:
ts0 = t # ts
related_exp t e
goal (2 subgoals):
1. \<And>ts thesis. \<lbrakk>\<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ts us; list_all2 related_v us []\<rbrakk> \<Longrightarrow> thesis; list_all pre_strong_term_class.wellformed ts; list_all (\<lambda>t. \<not> shadows_consts t) ts; list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts; list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts; list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts; list_all2 related_exp ts []\<rbrakk> \<Longrightarrow> thesis
2. \<And>a21 a22 b21 b22 ts thesis. \<lbrakk>cupcake_evaluate_single env a21 (Rval b21) \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa a21 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) (Rval b21))); \<And>ts thesis. \<lbrakk>\<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ts us; list_all2 related_v us b22\<rbrakk> \<Longrightarrow> thesis; list_all pre_strong_term_class.wellformed ts; list_all (\<lambda>t. \<not> shadows_consts t) ts; list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts; list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts; list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts; list_all2 related_exp ts a22\<rbrakk> \<Longrightarrow> thesis; \<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ts us; list_all2 related_v us (b21 # b22)\<rbrakk> \<Longrightarrow> thesis; list_all pre_strong_term_class.wellformed ts; list_all (\<lambda>t. \<not> shadows_consts t) ts; list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts; list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts; list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts; list_all2 related_exp ts (a21 # a22)\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
with Cons
[PROOF STATE]
proof (chain)
picking this:
cupcake_evaluate_single env e (Rval ml_v) \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa e \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) (Rval ml_v)))
\<lbrakk>\<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ?ts6 us; list_all2 related_v us ml_vs\<rbrakk> \<Longrightarrow> ?thesis6; list_all pre_strong_term_class.wellformed ?ts6; list_all (\<lambda>t. \<not> shadows_consts t) ?ts6; list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ?ts6; list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ?ts6; list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ?ts6; list_all2 related_exp ?ts6 es\<rbrakk> \<Longrightarrow> ?thesis6
\<lbrakk>list_all2 (veval' \<Gamma>) ts0 ?us6; list_all2 related_v ?us6 (ml_v # ml_vs)\<rbrakk> \<Longrightarrow> thesis
list_all pre_strong_term_class.wellformed ts0
list_all (\<lambda>t. \<not> shadows_consts t) ts0
list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts0
list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts0
list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts0
list_all2 related_exp ts0 (e # es)
ts0 = t # ts
related_exp t e
[PROOF STEP]
have "list_all2 related_exp ts es"
[PROOF STATE]
proof (prove)
using this:
cupcake_evaluate_single env e (Rval ml_v) \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa e \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) (Rval ml_v)))
\<lbrakk>\<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ?ts6 us; list_all2 related_v us ml_vs\<rbrakk> \<Longrightarrow> ?thesis6; list_all pre_strong_term_class.wellformed ?ts6; list_all (\<lambda>t. \<not> shadows_consts t) ?ts6; list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ?ts6; list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ?ts6; list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ?ts6; list_all2 related_exp ?ts6 es\<rbrakk> \<Longrightarrow> ?thesis6
\<lbrakk>list_all2 (veval' \<Gamma>) ts0 ?us6; list_all2 related_v ?us6 (ml_v # ml_vs)\<rbrakk> \<Longrightarrow> thesis
list_all pre_strong_term_class.wellformed ts0
list_all (\<lambda>t. \<not> shadows_consts t) ts0
list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts0
list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts0
list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts0
list_all2 related_exp ts0 (e # es)
ts0 = t # ts
related_exp t e
goal (1 subgoal):
1. list_all2 related_exp ts es
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
list_all2 related_exp ts es
goal (2 subgoals):
1. \<And>ts thesis. \<lbrakk>\<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ts us; list_all2 related_v us []\<rbrakk> \<Longrightarrow> thesis; list_all pre_strong_term_class.wellformed ts; list_all (\<lambda>t. \<not> shadows_consts t) ts; list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts; list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts; list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts; list_all2 related_exp ts []\<rbrakk> \<Longrightarrow> thesis
2. \<And>a21 a22 b21 b22 ts thesis. \<lbrakk>cupcake_evaluate_single env a21 (Rval b21) \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa a21 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) (Rval b21))); \<And>ts thesis. \<lbrakk>\<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ts us; list_all2 related_v us b22\<rbrakk> \<Longrightarrow> thesis; list_all pre_strong_term_class.wellformed ts; list_all (\<lambda>t. \<not> shadows_consts t) ts; list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts; list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts; list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts; list_all2 related_exp ts a22\<rbrakk> \<Longrightarrow> thesis; \<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ts us; list_all2 related_v us (b21 # b22)\<rbrakk> \<Longrightarrow> thesis; list_all pre_strong_term_class.wellformed ts; list_all (\<lambda>t. \<not> shadows_consts t) ts; list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts; list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts; list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts; list_all2 related_exp ts (a21 # a22)\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
with Cons
[PROOF STATE]
proof (chain)
picking this:
cupcake_evaluate_single env e (Rval ml_v) \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa e \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) (Rval ml_v)))
\<lbrakk>\<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ?ts6 us; list_all2 related_v us ml_vs\<rbrakk> \<Longrightarrow> ?thesis6; list_all pre_strong_term_class.wellformed ?ts6; list_all (\<lambda>t. \<not> shadows_consts t) ?ts6; list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ?ts6; list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ?ts6; list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ?ts6; list_all2 related_exp ?ts6 es\<rbrakk> \<Longrightarrow> ?thesis6
\<lbrakk>list_all2 (veval' \<Gamma>) ts0 ?us6; list_all2 related_v ?us6 (ml_v # ml_vs)\<rbrakk> \<Longrightarrow> thesis
list_all pre_strong_term_class.wellformed ts0
list_all (\<lambda>t. \<not> shadows_consts t) ts0
list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts0
list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts0
list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts0
list_all2 related_exp ts0 (e # es)
list_all2 related_exp ts es
[PROOF STEP]
obtain us where "list_all2 (veval' \<Gamma>) ts us" "list_all2 related_v us ml_vs"
[PROOF STATE]
proof (prove)
using this:
cupcake_evaluate_single env e (Rval ml_v) \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa e \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) (Rval ml_v)))
\<lbrakk>\<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ?ts6 us; list_all2 related_v us ml_vs\<rbrakk> \<Longrightarrow> ?thesis6; list_all pre_strong_term_class.wellformed ?ts6; list_all (\<lambda>t. \<not> shadows_consts t) ?ts6; list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ?ts6; list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ?ts6; list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ?ts6; list_all2 related_exp ?ts6 es\<rbrakk> \<Longrightarrow> ?thesis6
\<lbrakk>list_all2 (veval' \<Gamma>) ts0 ?us6; list_all2 related_v ?us6 (ml_v # ml_vs)\<rbrakk> \<Longrightarrow> thesisa__
list_all pre_strong_term_class.wellformed ts0
list_all (\<lambda>t. \<not> shadows_consts t) ts0
list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts0
list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts0
list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts0
list_all2 related_exp ts0 (e # es)
list_all2 related_exp ts es
goal (1 subgoal):
1. (\<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ts us; list_all2 related_v us ml_vs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding \<open>ts0 = _\<close>
[PROOF STATE]
proof (prove)
using this:
cupcake_evaluate_single env e (Rval ml_v) \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa e \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) (Rval ml_v)))
\<lbrakk>\<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ?ts6 us; list_all2 related_v us ml_vs\<rbrakk> \<Longrightarrow> ?thesis6; list_all pre_strong_term_class.wellformed ?ts6; list_all (\<lambda>t. \<not> shadows_consts t) ?ts6; list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ?ts6; list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ?ts6; list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ?ts6; list_all2 related_exp ?ts6 es\<rbrakk> \<Longrightarrow> ?thesis6
\<lbrakk>list_all2 (veval' \<Gamma>) (t # ts) ?us6; list_all2 related_v ?us6 (ml_v # ml_vs)\<rbrakk> \<Longrightarrow> thesisa__
list_all pre_strong_term_class.wellformed (t # ts)
list_all (\<lambda>t. \<not> shadows_consts t) (t # ts)
list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) (t # ts)
list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) (t # ts)
list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) (t # ts)
list_all2 related_exp (t # ts) (e # es)
list_all2 related_exp ts es
goal (1 subgoal):
1. (\<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ts us; list_all2 related_v us ml_vs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
list_all2 (veval' \<Gamma>) ts us
list_all2 related_v us ml_vs
goal (2 subgoals):
1. \<And>ts thesis. \<lbrakk>\<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ts us; list_all2 related_v us []\<rbrakk> \<Longrightarrow> thesis; list_all pre_strong_term_class.wellformed ts; list_all (\<lambda>t. \<not> shadows_consts t) ts; list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts; list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts; list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts; list_all2 related_exp ts []\<rbrakk> \<Longrightarrow> thesis
2. \<And>a21 a22 b21 b22 ts thesis. \<lbrakk>cupcake_evaluate_single env a21 (Rval b21) \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa a21 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) (Rval b21))); \<And>ts thesis. \<lbrakk>\<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ts us; list_all2 related_v us b22\<rbrakk> \<Longrightarrow> thesis; list_all pre_strong_term_class.wellformed ts; list_all (\<lambda>t. \<not> shadows_consts t) ts; list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts; list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts; list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts; list_all2 related_exp ts a22\<rbrakk> \<Longrightarrow> thesis; \<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ts us; list_all2 related_v us (b21 # b22)\<rbrakk> \<Longrightarrow> thesis; list_all pre_strong_term_class.wellformed ts; list_all (\<lambda>t. \<not> shadows_consts t) ts; list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts; list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts; list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts; list_all2 related_exp ts (a21 # a22)\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
from Cons.hyps[simplified, THEN conjunct2, rule_format, of t \<Gamma>]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
obtain u where "\<Gamma> \<turnstile>\<^sub>v t \<down> u " "related_v u ml_v"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
goal (1 subgoal):
1. (\<And>u. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v t \<down> u; related_v u ml_v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (13 subgoals):
1. (\<And>u. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v t \<down> u; related_v u ml_v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> is_cupcake_all_env env
2. (\<And>u. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v t \<down> u; related_v u ml_v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
3. (\<And>u. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v t \<down> u; related_v u ml_v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> related_exp t e
4. (\<And>u. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v t \<down> u; related_v u ml_v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed t
5. (\<And>u. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v t \<down> u; related_v u ml_v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> wellformed_venv \<Gamma>
6. (\<And>u. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v t \<down> u; related_v u ml_v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_venv \<Gamma>
7. (\<And>u. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v t \<down> u; related_v u ml_v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except t (fmdom \<Gamma>)
8. (\<And>u. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v t \<down> u; related_v u ml_v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') \<Gamma>
9. (\<And>u. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v t \<down> u; related_v u ml_v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
10. (\<And>u. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v t \<down> u; related_v u ml_v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom \<Gamma>)
A total of 13 subgoals...
[PROOF STEP]
show
"is_cupcake_all_env env" "related_exp t e" "wellformed_venv \<Gamma>" "closed_venv \<Gamma>"
"fmpred (\<lambda>_. vwelldefined') \<Gamma>" "fdisjnt C (fmdom \<Gamma>)"
"not_shadows_vconsts_env \<Gamma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (is_cupcake_all_env env &&& related_exp t e &&& wellformed_venv \<Gamma>) &&& (closed_venv \<Gamma> &&& fmpred (\<lambda>_. vwelldefined') \<Gamma>) &&& fdisjnt C (fmdom \<Gamma>) &&& not_shadows_vconsts_env \<Gamma>
[PROOF STEP]
by fact+
[PROOF STATE]
proof (state)
this:
is_cupcake_all_env env
related_exp t e
wellformed_venv \<Gamma>
closed_venv \<Gamma>
fmpred (\<lambda>_. vwelldefined') \<Gamma>
fdisjnt C (fmdom \<Gamma>)
not_shadows_vconsts_env \<Gamma>
goal (6 subgoals):
1. (\<And>u. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v t \<down> u; related_v u ml_v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
2. (\<And>u. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v t \<down> u; related_v u ml_v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed t
3. (\<And>u. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v t \<down> u; related_v u ml_v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except t (fmdom \<Gamma>)
4. (\<And>u. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v t \<down> u; related_v u ml_v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
5. (\<And>u. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v t \<down> u; related_v u ml_v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts t
6. \<And>x. \<lbrakk>\<And>u. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v t \<down> u; related_v u ml_v\<rbrakk> \<Longrightarrow> thesis; \<Gamma> \<turnstile>\<^sub>v t \<down> x \<and> related_v x ml_v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (6 subgoals):
1. (\<And>u. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v t \<down> u; related_v u ml_v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
2. (\<And>u. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v t \<down> u; related_v u ml_v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed t
3. (\<And>u. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v t \<down> u; related_v u ml_v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except t (fmdom \<Gamma>)
4. (\<And>u. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v t \<down> u; related_v u ml_v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
5. (\<And>u. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v t \<down> u; related_v u ml_v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts t
6. \<And>x. \<lbrakk>\<And>u. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v t \<down> u; related_v u ml_v\<rbrakk> \<Longrightarrow> thesis; \<Gamma> \<turnstile>\<^sub>v t \<down> x \<and> related_v x ml_v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show
"wellformed t" "\<not> shadows_consts t" "closed_except t (fmdom \<Gamma>)"
"consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C" "fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (pre_strong_term_class.wellformed t &&& \<not> shadows_consts t) &&& closed_except t (fmdom \<Gamma>) &&& consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C &&& fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
cupcake_evaluate_single env e (Rval ml_v) \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa e \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) (Rval ml_v)))
\<lbrakk>\<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ?ts6 us; list_all2 related_v us ml_vs\<rbrakk> \<Longrightarrow> ?thesis6; list_all pre_strong_term_class.wellformed ?ts6; list_all (\<lambda>t. \<not> shadows_consts t) ?ts6; list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ?ts6; list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ?ts6; list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ?ts6; list_all2 related_exp ?ts6 es\<rbrakk> \<Longrightarrow> ?thesis6
\<lbrakk>list_all2 (veval' \<Gamma>) ts0 ?us6; list_all2 related_v ?us6 (ml_v # ml_vs)\<rbrakk> \<Longrightarrow> thesisa__
list_all pre_strong_term_class.wellformed ts0
list_all (\<lambda>t. \<not> shadows_consts t) ts0
list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts0
list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts0
list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts0
list_all2 related_exp ts0 (e # es)
goal (1 subgoal):
1. (pre_strong_term_class.wellformed t &&& \<not> shadows_consts t) &&& closed_except t (fmdom \<Gamma>) &&& consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C &&& fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
[PROOF STEP]
unfolding \<open>ts0 = _\<close>
[PROOF STATE]
proof (prove)
using this:
cupcake_evaluate_single env e (Rval ml_v) \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa e \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) (Rval ml_v)))
\<lbrakk>\<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ?ts6 us; list_all2 related_v us ml_vs\<rbrakk> \<Longrightarrow> ?thesis6; list_all pre_strong_term_class.wellformed ?ts6; list_all (\<lambda>t. \<not> shadows_consts t) ?ts6; list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ?ts6; list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ?ts6; list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ?ts6; list_all2 related_exp ?ts6 es\<rbrakk> \<Longrightarrow> ?thesis6
\<lbrakk>list_all2 (veval' \<Gamma>) (t # ts) ?us6; list_all2 related_v ?us6 (ml_v # ml_vs)\<rbrakk> \<Longrightarrow> thesisa__
list_all pre_strong_term_class.wellformed (t # ts)
list_all (\<lambda>t. \<not> shadows_consts t) (t # ts)
list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) (t # ts)
list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) (t # ts)
list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) (t # ts)
list_all2 related_exp (t # ts) (e # es)
goal (1 subgoal):
1. (pre_strong_term_class.wellformed t &&& \<not> shadows_consts t) &&& closed_except t (fmdom \<Gamma>) &&& consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C &&& fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
pre_strong_term_class.wellformed t
\<not> shadows_consts t
closed_except t (fmdom \<Gamma>)
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
goal (1 subgoal):
1. \<And>x. \<lbrakk>\<And>u. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v t \<down> u; related_v u ml_v\<rbrakk> \<Longrightarrow> thesis; \<Gamma> \<turnstile>\<^sub>v t \<down> x \<and> related_v x ml_v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
qed blast
[PROOF STATE]
proof (state)
this:
\<Gamma> \<turnstile>\<^sub>v t \<down> u
related_v u ml_v
goal (2 subgoals):
1. \<And>ts thesis. \<lbrakk>\<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ts us; list_all2 related_v us []\<rbrakk> \<Longrightarrow> thesis; list_all pre_strong_term_class.wellformed ts; list_all (\<lambda>t. \<not> shadows_consts t) ts; list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts; list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts; list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts; list_all2 related_exp ts []\<rbrakk> \<Longrightarrow> thesis
2. \<And>a21 a22 b21 b22 ts thesis. \<lbrakk>cupcake_evaluate_single env a21 (Rval b21) \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa a21 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) (Rval b21))); \<And>ts thesis. \<lbrakk>\<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ts us; list_all2 related_v us b22\<rbrakk> \<Longrightarrow> thesis; list_all pre_strong_term_class.wellformed ts; list_all (\<lambda>t. \<not> shadows_consts t) ts; list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts; list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts; list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts; list_all2 related_exp ts a22\<rbrakk> \<Longrightarrow> thesis; \<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ts us; list_all2 related_v us (b21 # b22)\<rbrakk> \<Longrightarrow> thesis; list_all pre_strong_term_class.wellformed ts; list_all (\<lambda>t. \<not> shadows_consts t) ts; list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts; list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts; list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts; list_all2 related_exp ts (a21 # a22)\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. thesis
[PROOF STEP]
apply (rule Cons(3)[of "u # us"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. list_all2 (veval' \<Gamma>) ts0 (u # us)
2. list_all2 related_v (u # us) (ml_v # ml_vs)
[PROOF STEP]
unfolding \<open>ts0 = _\<close>
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. list_all2 (veval' \<Gamma>) (t # ts) (u # us)
2. list_all2 related_v (u # us) (ml_v # ml_vs)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (4 subgoals):
1. \<Gamma> \<turnstile>\<^sub>v t \<down> u
2. list_all2 (veval' \<Gamma>) ts us
3. related_v u ml_v
4. list_all2 related_v us ml_vs
[PROOF STEP]
apply fact+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
thesis
goal (1 subgoal):
1. \<And>ts thesis. \<lbrakk>\<And>us. \<lbrakk>list_all2 (veval' \<Gamma>) ts us; list_all2 related_v us []\<rbrakk> \<Longrightarrow> thesis; list_all pre_strong_term_class.wellformed ts; list_all (\<lambda>t. \<not> shadows_consts t) ts; list_all (\<lambda>t. consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) ts; list_all (\<lambda>t. closed_except t (fmdom \<Gamma>)) ts; list_all (\<lambda>t'. fmrel_on_fset (ids t') related_v \<Gamma> (fmap_of_ns (sem_env.v env))) ts; list_all2 related_exp ts []\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
list_all2 (veval' \<Gamma>) ts us
list_all2 related_v us ml_vs'
goal (12 subgoals):
1. \<And>env cn es rs vs v0 \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; build_conv (sem_env.c env) cn (rev vs) = Some v0; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0)
2. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
3. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
4. \<And>env n v0 \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = Some v0; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0)
5. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env n e \<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Fun n e); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval (Closure env n e))
7. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
9. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
10. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
A total of 12 subgoals...
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval ml_v')
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v'
[PROOF STEP]
apply (intro exI conjI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<Gamma> \<turnstile>\<^sub>v t \<down> ?v
2. related_v ?v ml_v'
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<Gamma> \<turnstile>\<^sub>v name $$ ts \<down> ?v
2. related_v ?v ml_v'
[PROOF STEP]
apply (rule veval'.constr)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. name |\<in>| C
2. list_all2 (veval' \<Gamma>) ts ?us2
3. related_v (Vconstr name ?us2) ml_v'
[PROOF STEP]
apply fact+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. related_v (Vconstr name us) ml_v'
[PROOF STEP]
unfolding \<open>ml_v' = _\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. related_v (Vconstr name us) (Conv (Some (id_to_n (Short (as_string name)), tid)) (rev ml_vs))
[PROOF STEP]
apply (subst ml_vs'_def[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. related_v (Vconstr name us) (Conv (Some (id_to_n (Short (as_string name)), tid)) ml_vs')
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. related_v (Vconstr name us) (Conv (Some (as_string name, tid)) ml_vs')
[PROOF STEP]
apply (rule related_v.conv)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. list_all2 related_v us ml_vs'
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval ml_v')
goal (11 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n v0 \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = Some v0; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0)
4. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
5. \<And>env n e \<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Fun n e); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval (Closure env n e))
6. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
7. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
8. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
10. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
A total of 11 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (11 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n v0 \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = Some v0; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0)
4. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
5. \<And>env n e \<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Fun n e); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval (Closure env n e))
6. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
7. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
8. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
10. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
A total of 11 subgoals...
[PROOF STEP]
case (var1 env id ml_v)
[PROOF STATE]
proof (state)
this:
nsLookup (sem_env.v env) id = Some ml_v
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (Var id)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
goal (11 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n v0 \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = Some v0; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0)
4. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
5. \<And>env n e \<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Fun n e); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval (Closure env n e))
6. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
7. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
8. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
10. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
A total of 11 subgoals...
[PROOF STEP]
from \<open>related_exp t (Var id)\<close>
[PROOF STATE]
proof (chain)
picking this:
related_exp t (Var id)
[PROOF STEP]
obtain name where "id = Short (as_string name)"
[PROOF STATE]
proof (prove)
using this:
related_exp t (Var id)
goal (1 subgoal):
1. (\<And>name. id = Short (as_string name) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by cases auto
[PROOF STATE]
proof (state)
this:
id = Short (as_string name)
goal (11 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n v0 \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = Some v0; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0)
4. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
5. \<And>env n e \<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Fun n e); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval (Closure env n e))
6. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
7. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
8. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
10. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
A total of 11 subgoals...
[PROOF STEP]
with var1
[PROOF STATE]
proof (chain)
picking this:
nsLookup (sem_env.v env) id = Some ml_v
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (Var id)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
id = Short (as_string name)
[PROOF STEP]
have "cupcake_nsLookup (sem_env.v env) (as_string name) = Some ml_v"
[PROOF STATE]
proof (prove)
using this:
nsLookup (sem_env.v env) id = Some ml_v
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (Var id)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
id = Short (as_string name)
goal (1 subgoal):
1. cupcake_nsLookup (sem_env.v env) (as_string name) = Some ml_v
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cupcake_nsLookup (sem_env.v env) (as_string name) = Some ml_v
goal (11 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n v0 \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = Some v0; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0)
4. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
5. \<And>env n e \<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Fun n e); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval (Closure env n e))
6. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
7. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
8. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
10. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
A total of 11 subgoals...
[PROOF STEP]
from \<open>related_exp t (Var id)\<close>
[PROOF STATE]
proof (chain)
picking this:
related_exp t (Var id)
[PROOF STEP]
consider
(var) "t = Svar name"
| (const) "t = Sconst name" "name |\<notin>| C"
[PROOF STATE]
proof (prove)
using this:
related_exp t (Var id)
goal (1 subgoal):
1. \<lbrakk>t = Svar name \<Longrightarrow> thesis; \<lbrakk>t = Sconst name; name |\<notin>| C\<rbrakk> \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
unfolding \<open>id = _\<close>
[PROOF STATE]
proof (prove)
using this:
related_exp t (Var (Short (as_string name)))
goal (1 subgoal):
1. \<lbrakk>t = Svar name \<Longrightarrow> thesis; \<lbrakk>t = Sconst name; name |\<notin>| C\<rbrakk> \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
apply (cases t)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<And>namea. \<lbrakk>t = Svar name \<Longrightarrow> thesis; \<lbrakk>t = Sconst name; name |\<notin>| C\<rbrakk> \<Longrightarrow> thesis; t = Svar namea; as_string name = as_string namea\<rbrakk> \<Longrightarrow> thesis
2. \<And>namea. \<lbrakk>t = Svar name \<Longrightarrow> thesis; \<lbrakk>t = Sconst name; name |\<notin>| C\<rbrakk> \<Longrightarrow> thesis; t = Sconst namea; as_string name = as_string namea; namea |\<notin>| C\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
using name.expand
[PROOF STATE]
proof (prove)
using this:
as_string ?name = as_string ?name' \<Longrightarrow> ?name = ?name'
goal (2 subgoals):
1. \<And>namea. \<lbrakk>t = Svar name \<Longrightarrow> thesis; \<lbrakk>t = Sconst name; name |\<notin>| C\<rbrakk> \<Longrightarrow> thesis; t = Svar namea; as_string name = as_string namea\<rbrakk> \<Longrightarrow> thesis
2. \<And>namea. \<lbrakk>t = Svar name \<Longrightarrow> thesis; \<lbrakk>t = Sconst name; name |\<notin>| C\<rbrakk> \<Longrightarrow> thesis; t = Sconst namea; as_string name = as_string namea; namea |\<notin>| C\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
\<lbrakk>t = Svar name \<Longrightarrow> ?thesis4; \<lbrakk>t = Sconst name; name |\<notin>| C\<rbrakk> \<Longrightarrow> ?thesis4\<rbrakk> \<Longrightarrow> ?thesis4
goal (11 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n v0 \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = Some v0; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0)
4. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
5. \<And>env n e \<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Fun n e); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval (Closure env n e))
6. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
7. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
8. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
10. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
A total of 11 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>t = Svar name \<Longrightarrow> ?thesis4; \<lbrakk>t = Sconst name; name |\<notin>| C\<rbrakk> \<Longrightarrow> ?thesis4\<rbrakk> \<Longrightarrow> ?thesis4
goal (1 subgoal):
1. if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval ml_v)
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. t = Svar name \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval ml_v)
2. \<lbrakk>t = Sconst name; name |\<notin>| C\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval ml_v)
[PROOF STEP]
case var
[PROOF STATE]
proof (state)
this:
t = Svar name
goal (2 subgoals):
1. t = Svar name \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval ml_v)
2. \<lbrakk>t = Sconst name; name |\<notin>| C\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval ml_v)
[PROOF STEP]
hence "name |\<in>| ids t"
[PROOF STATE]
proof (prove)
using this:
t = Svar name
goal (1 subgoal):
1. name |\<in>| ids t
[PROOF STEP]
unfolding ids_def
[PROOF STATE]
proof (prove)
using this:
t = Svar name
goal (1 subgoal):
1. name |\<in>| frees t |\<union>| consts t
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
name |\<in>| ids t
goal (2 subgoals):
1. t = Svar name \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval ml_v)
2. \<lbrakk>t = Sconst name; name |\<notin>| C\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval ml_v)
[PROOF STEP]
have "rel_option related_v (fmlookup \<Gamma> name) (cupcake_nsLookup (sem_env.v env) (as_string name))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. rel_option related_v (fmlookup \<Gamma> name) (cupcake_nsLookup (sem_env.v env) (as_string name))
[PROOF STEP]
using \<open>fmrel_on_fset (ids t) _ _ _\<close>
[PROOF STATE]
proof (prove)
using this:
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
goal (1 subgoal):
1. rel_option related_v (fmlookup \<Gamma> name) (cupcake_nsLookup (sem_env.v env) (as_string name))
[PROOF STEP]
apply -
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)) \<Longrightarrow> rel_option related_v (fmlookup \<Gamma> name) (cupcake_nsLookup (sem_env.v env) (as_string name))
[PROOF STEP]
apply (drule fmrel_on_fsetD[OF \<open>name |\<in>| ids t\<close>])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. rel_option related_v (fmlookup \<Gamma> name) (fmlookup (fmap_of_ns (sem_env.v env)) name) \<Longrightarrow> rel_option related_v (fmlookup \<Gamma> name) (cupcake_nsLookup (sem_env.v env) (as_string name))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
rel_option related_v (fmlookup \<Gamma> name) (cupcake_nsLookup (sem_env.v env) (as_string name))
goal (2 subgoals):
1. t = Svar name \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval ml_v)
2. \<lbrakk>t = Sconst name; name |\<notin>| C\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval ml_v)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
rel_option related_v (fmlookup \<Gamma> name) (cupcake_nsLookup (sem_env.v env) (as_string name))
[PROOF STEP]
obtain v where "related_v v ml_v" "fmlookup \<Gamma> name = Some v"
[PROOF STATE]
proof (prove)
using this:
rel_option related_v (fmlookup \<Gamma> name) (cupcake_nsLookup (sem_env.v env) (as_string name))
goal (1 subgoal):
1. (\<And>v. \<lbrakk>related_v v ml_v; fmlookup \<Gamma> name = Some v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>cupcake_nsLookup (sem_env.v env) _ = _\<close>
[PROOF STATE]
proof (prove)
using this:
rel_option related_v (fmlookup \<Gamma> name) (cupcake_nsLookup (sem_env.v env) (as_string name))
cupcake_nsLookup (sem_env.v env) (as_string name) = Some ml_v
goal (1 subgoal):
1. (\<And>v. \<lbrakk>related_v v ml_v; fmlookup \<Gamma> name = Some v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by cases auto
[PROOF STATE]
proof (state)
this:
related_v v ml_v
fmlookup \<Gamma> name = Some v
goal (2 subgoals):
1. t = Svar name \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval ml_v)
2. \<lbrakk>t = Sconst name; name |\<notin>| C\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval ml_v)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval ml_v)
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v Svar name \<down> v \<and> related_v v ml_v) (Rval ml_v)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<exists>v. \<Gamma> \<turnstile>\<^sub>v Svar name \<down> v \<and> related_v v ml_v
[PROOF STEP]
apply (rule exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<Gamma> \<turnstile>\<^sub>v Svar name \<down> ?v \<and> related_v ?v ml_v
[PROOF STEP]
apply (rule conjI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<Gamma> \<turnstile>\<^sub>v Svar name \<down> ?v
2. related_v ?v ml_v
[PROOF STEP]
apply (rule veval'.var)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. fmlookup \<Gamma> name = Some ?v
2. related_v ?v ml_v
[PROOF STEP]
apply fact+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval ml_v)
goal (1 subgoal):
1. \<lbrakk>t = Sconst name; name |\<notin>| C\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval ml_v)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<lbrakk>t = Sconst name; name |\<notin>| C\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval ml_v)
[PROOF STEP]
case const
[PROOF STATE]
proof (state)
this:
t = Sconst name
name |\<notin>| C
goal (1 subgoal):
1. \<lbrakk>t = Sconst name; name |\<notin>| C\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval ml_v)
[PROOF STEP]
hence "name |\<in>| ids t"
[PROOF STATE]
proof (prove)
using this:
t = Sconst name
name |\<notin>| C
goal (1 subgoal):
1. name |\<in>| ids t
[PROOF STEP]
unfolding ids_def
[PROOF STATE]
proof (prove)
using this:
t = Sconst name
name |\<notin>| C
goal (1 subgoal):
1. name |\<in>| frees t |\<union>| consts t
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
name |\<in>| ids t
goal (1 subgoal):
1. \<lbrakk>t = Sconst name; name |\<notin>| C\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval ml_v)
[PROOF STEP]
have "rel_option related_v (fmlookup \<Gamma> name) (cupcake_nsLookup (sem_env.v env) (as_string name))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. rel_option related_v (fmlookup \<Gamma> name) (cupcake_nsLookup (sem_env.v env) (as_string name))
[PROOF STEP]
using \<open>fmrel_on_fset (ids t) _ _ _\<close>
[PROOF STATE]
proof (prove)
using this:
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
goal (1 subgoal):
1. rel_option related_v (fmlookup \<Gamma> name) (cupcake_nsLookup (sem_env.v env) (as_string name))
[PROOF STEP]
apply -
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)) \<Longrightarrow> rel_option related_v (fmlookup \<Gamma> name) (cupcake_nsLookup (sem_env.v env) (as_string name))
[PROOF STEP]
apply (drule fmrel_on_fsetD[OF \<open>name |\<in>| ids t\<close>])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. rel_option related_v (fmlookup \<Gamma> name) (fmlookup (fmap_of_ns (sem_env.v env)) name) \<Longrightarrow> rel_option related_v (fmlookup \<Gamma> name) (cupcake_nsLookup (sem_env.v env) (as_string name))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
rel_option related_v (fmlookup \<Gamma> name) (cupcake_nsLookup (sem_env.v env) (as_string name))
goal (1 subgoal):
1. \<lbrakk>t = Sconst name; name |\<notin>| C\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval ml_v)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
rel_option related_v (fmlookup \<Gamma> name) (cupcake_nsLookup (sem_env.v env) (as_string name))
[PROOF STEP]
obtain v where "related_v v ml_v" "fmlookup \<Gamma> name = Some v"
[PROOF STATE]
proof (prove)
using this:
rel_option related_v (fmlookup \<Gamma> name) (cupcake_nsLookup (sem_env.v env) (as_string name))
goal (1 subgoal):
1. (\<And>v. \<lbrakk>related_v v ml_v; fmlookup \<Gamma> name = Some v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>cupcake_nsLookup (sem_env.v env) _ = _\<close>
[PROOF STATE]
proof (prove)
using this:
rel_option related_v (fmlookup \<Gamma> name) (cupcake_nsLookup (sem_env.v env) (as_string name))
cupcake_nsLookup (sem_env.v env) (as_string name) = Some ml_v
goal (1 subgoal):
1. (\<And>v. \<lbrakk>related_v v ml_v; fmlookup \<Gamma> name = Some v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by cases auto
[PROOF STATE]
proof (state)
this:
related_v v ml_v
fmlookup \<Gamma> name = Some v
goal (1 subgoal):
1. \<lbrakk>t = Sconst name; name |\<notin>| C\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval ml_v)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval ml_v)
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v Sconst name \<down> v \<and> related_v v ml_v) (Rval ml_v)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<exists>v. \<Gamma> \<turnstile>\<^sub>v Sconst name \<down> v \<and> related_v v ml_v
[PROOF STEP]
apply (rule exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<Gamma> \<turnstile>\<^sub>v Sconst name \<down> ?v \<and> related_v ?v ml_v
[PROOF STEP]
apply (rule conjI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<Gamma> \<turnstile>\<^sub>v Sconst name \<down> ?v
2. related_v ?v ml_v
[PROOF STEP]
apply (rule veval'.const)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. name |\<notin>| C
2. fmlookup \<Gamma> name = Some ?v
3. related_v ?v ml_v
[PROOF STEP]
apply fact+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval ml_v)
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval ml_v)
goal (10 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env n e \<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Fun n e); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval (Closure env n e))
5. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
6. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
7. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
8. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
9. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
10. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (10 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env n e \<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Fun n e); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval (Closure env n e))
5. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
6. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
7. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
8. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
9. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
10. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
case (fn env n u)
[PROOF STATE]
proof (state)
this:
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (Fun n u)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
goal (10 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env n e \<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Fun n e); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval (Closure env n e))
5. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
6. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
7. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
8. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
9. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
10. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
obtain n' where "n = as_string n'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<And>n'. n = as_string n' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis name.sel)
[PROOF STATE]
proof (state)
this:
n = as_string n'
goal (10 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env n e \<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Fun n e); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval (Closure env n e))
5. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
6. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
7. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
8. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
9. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
10. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
obtain cs ml_cs
where "t = Sabs cs" "u = Mat (Var (Short (as_string n'))) ml_cs" "n' |\<notin>| ids (Sabs cs)" "n' |\<notin>| all_consts"
and "list_all2 (rel_prod related_pat related_exp) cs ml_cs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<And>cs ml_cs. \<lbrakk>t = Sabs cs; u = Mat (Var (Short (as_string n'))) ml_cs; n' |\<notin>| ids (Sabs cs); n' |\<notin>| all_consts; list_all2 (rel_prod related_pat related_exp) cs ml_cs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>related_exp t (Fun n u)\<close>
[PROOF STATE]
proof (prove)
using this:
related_exp t (Fun n u)
goal (1 subgoal):
1. (\<And>cs ml_cs. \<lbrakk>t = Sabs cs; u = Mat (Var (Short (as_string n'))) ml_cs; n' |\<notin>| ids (Sabs cs); n' |\<notin>| all_consts; list_all2 (rel_prod related_pat related_exp) cs ml_cs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding \<open>n = _\<close>
[PROOF STATE]
proof (prove)
using this:
related_exp t (Fun (as_string n') u)
goal (1 subgoal):
1. (\<And>cs ml_cs. \<lbrakk>t = Sabs cs; u = Mat (Var (Short (as_string n'))) ml_cs; n' |\<notin>| ids (Sabs cs); n' |\<notin>| all_consts; list_all2 (rel_prod related_pat related_exp) cs ml_cs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by cases (auto dest: name.expand)
[PROOF STATE]
proof (state)
this:
t = Sabs cs
u = Mat (Var (Short (as_string n'))) ml_cs
n' |\<notin>| ids (Sabs cs)
n' |\<notin>| all_consts
list_all2 (rel_prod related_pat related_exp) cs ml_cs
goal (10 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env n e \<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Fun n e); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval (Closure env n e))
5. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
6. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
7. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
8. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
9. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
10. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
obtain ns where "fmap_of_ns (sem_env.v env) = fmap_of_list ns"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<And>ns. fmap_of_ns (sem_env.v env) = fmap_of_list ns \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
apply (cases env)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<And>x1 x2. \<lbrakk>\<And>ns. fmap_of_ns (sem_env.v env) = fmap_of_list ns \<Longrightarrow> thesis; env = make_sem_env x1 x2\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<And>x1 x2. \<lbrakk>\<And>ns. fmap_of_ns x1 = fmap_of_list ns \<Longrightarrow> thesis; env = make_sem_env x1 x2\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
subgoal for v
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>\<And>ns. fmap_of_ns v = fmap_of_list ns \<Longrightarrow> thesis; env = make_sem_env v x2_\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
by (cases v) simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
fmap_of_ns (sem_env.v env) = fmap_of_list ns
goal (10 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env n e \<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Fun n e); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval (Closure env n e))
5. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
6. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
7. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
8. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
9. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
10. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval (Closure env n u))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v (Closure env n u)
[PROOF STEP]
apply (rule exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<Gamma> \<turnstile>\<^sub>v t \<down> ?v \<and> related_v ?v (Closure env n u)
[PROOF STEP]
apply (rule conjI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<Gamma> \<turnstile>\<^sub>v t \<down> ?v
2. related_v ?v (Closure env n u)
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<Gamma> \<turnstile>\<^sub>v Sabs cs \<down> ?v
2. related_v ?v (Closure env n u)
[PROOF STEP]
apply (rule veval'.abs)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. related_v (Vabs cs \<Gamma>) (Closure env n u)
[PROOF STEP]
unfolding \<open>n = _\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. related_v (Vabs cs \<Gamma>) (Closure env (as_string n') u)
[PROOF STEP]
apply (rule related_v.closure)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. related_fun cs n' u
2. fmrel_on_fset (ids (Sabs cs)) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
[PROOF STEP]
unfolding \<open>u = _\<close>
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. related_fun cs n' (Mat (Var (Short (as_string n'))) ml_cs)
2. fmrel_on_fset (ids (Sabs cs)) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
[PROOF STEP]
apply (subst related_fun_alt_def; rule conjI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. list_all2 (rel_prod related_pat related_exp) cs ml_cs
2. n' |\<notin>| ids (Sabs cs) \<and> n' |\<notin>| all_consts
3. fmrel_on_fset (ids (Sabs cs)) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. n' |\<notin>| ids (Sabs cs) \<and> n' |\<notin>| all_consts
2. fmrel_on_fset (ids (Sabs cs)) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
[PROOF STEP]
apply (rule conjI; fact)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmrel_on_fset (ids (Sabs cs)) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
[PROOF STEP]
using \<open>fmrel_on_fset (ids t) _ _ _\<close>
[PROOF STATE]
proof (prove)
using this:
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
goal (1 subgoal):
1. fmrel_on_fset (ids (Sabs cs)) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
[PROOF STEP]
unfolding \<open>t = _\<close> \<open>fmap_of_ns (sem_env.v env) = _\<close>
[PROOF STATE]
proof (prove)
using this:
fmrel_on_fset (ids (Sabs cs)) related_v \<Gamma> (fmap_of_list ns)
goal (1 subgoal):
1. fmrel_on_fset (ids (Sabs cs)) related_v \<Gamma> (fmap_of_list ns)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval (Closure env n u))
goal (9 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
5. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
7. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (9 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
5. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
7. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
case (app1 env exps ress ml_vs env' exp' bv)
[PROOF STATE]
proof (state)
this:
list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev exps) ress
\<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env')); related_exp ?t4 exp'; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) bv
sequence_result ress = Rval ml_vs
do_opapp (rev ml_vs) = Some (env', exp')
cupcake_evaluate_single env' exp' bv
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (exp0.App Opapp exps)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
goal (9 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
5. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
7. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
from \<open>related_exp t _\<close>
[PROOF STATE]
proof (chain)
picking this:
related_exp t (exp0.App Opapp exps)
[PROOF STEP]
obtain exp\<^sub>1 exp\<^sub>2 t\<^sub>1 t\<^sub>2
where "rev exps = [exp\<^sub>2, exp\<^sub>1]" "exps = [exp\<^sub>1, exp\<^sub>2]" "t = t\<^sub>1 $\<^sub>s t\<^sub>2"
and "related_exp t\<^sub>1 exp\<^sub>1" "related_exp t\<^sub>2 exp\<^sub>2"
[PROOF STATE]
proof (prove)
using this:
related_exp t (exp0.App Opapp exps)
goal (1 subgoal):
1. (\<And>exp\<^sub>2 exp\<^sub>1 t\<^sub>1 t\<^sub>2. \<lbrakk>rev exps = [exp\<^sub>2, exp\<^sub>1]; exps = [exp\<^sub>1, exp\<^sub>2]; t = t\<^sub>1 $\<^sub>s t\<^sub>2; related_exp t\<^sub>1 exp\<^sub>1; related_exp t\<^sub>2 exp\<^sub>2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by cases auto
[PROOF STATE]
proof (state)
this:
rev exps = [exp\<^sub>2, exp\<^sub>1]
exps = [exp\<^sub>1, exp\<^sub>2]
t = t\<^sub>1 $\<^sub>s t\<^sub>2
related_exp t\<^sub>1 exp\<^sub>1
related_exp t\<^sub>2 exp\<^sub>2
goal (9 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
5. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
7. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
rev exps = [exp\<^sub>2, exp\<^sub>1]
exps = [exp\<^sub>1, exp\<^sub>2]
t = t\<^sub>1 $\<^sub>s t\<^sub>2
related_exp t\<^sub>1 exp\<^sub>1
related_exp t\<^sub>2 exp\<^sub>2
goal (9 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
5. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
7. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
from app1
[PROOF STATE]
proof (chain)
picking this:
list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev exps) ress
\<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env')); related_exp ?t4 exp'; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) bv
sequence_result ress = Rval ml_vs
do_opapp (rev ml_vs) = Some (env', exp')
cupcake_evaluate_single env' exp' bv
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (exp0.App Opapp exps)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
[PROOF STEP]
have "ress = map Rval ml_vs"
[PROOF STATE]
proof (prove)
using this:
list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev exps) ress
\<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env')); related_exp ?t4 exp'; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) bv
sequence_result ress = Rval ml_vs
do_opapp (rev ml_vs) = Some (env', exp')
cupcake_evaluate_single env' exp' bv
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (exp0.App Opapp exps)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
goal (1 subgoal):
1. ress = map Rval ml_vs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ress = map Rval ml_vs
goal (9 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
5. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
7. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
rev exps = [exp\<^sub>2, exp\<^sub>1]
exps = [exp\<^sub>1, exp\<^sub>2]
t = t\<^sub>1 $\<^sub>s t\<^sub>2
related_exp t\<^sub>1 exp\<^sub>1
related_exp t\<^sub>2 exp\<^sub>2
ress = map Rval ml_vs
[PROOF STEP]
obtain ml_v\<^sub>1 ml_v\<^sub>2 where "ml_vs = [ml_v\<^sub>2, ml_v\<^sub>1]"
[PROOF STATE]
proof (prove)
using this:
rev exps = [exp\<^sub>2, exp\<^sub>1]
exps = [exp\<^sub>1, exp\<^sub>2]
t = t\<^sub>1 $\<^sub>s t\<^sub>2
related_exp t\<^sub>1 exp\<^sub>1
related_exp t\<^sub>2 exp\<^sub>2
ress = map Rval ml_vs
goal (1 subgoal):
1. (\<And>ml_v\<^sub>2 ml_v\<^sub>1. ml_vs = [ml_v\<^sub>2, ml_v\<^sub>1] \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using app1(1)
[PROOF STATE]
proof (prove)
using this:
rev exps = [exp\<^sub>2, exp\<^sub>1]
exps = [exp\<^sub>1, exp\<^sub>2]
t = t\<^sub>1 $\<^sub>s t\<^sub>2
related_exp t\<^sub>1 exp\<^sub>1
related_exp t\<^sub>2 exp\<^sub>2
ress = map Rval ml_vs
list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev exps) ress
goal (1 subgoal):
1. (\<And>ml_v\<^sub>2 ml_v\<^sub>1. ml_vs = [ml_v\<^sub>2, ml_v\<^sub>1] \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (smt list_all2_shortcircuit_rval list_all2_Cons1 list_all2_Nil)
[PROOF STATE]
proof (state)
this:
ml_vs = [ml_v\<^sub>2, ml_v\<^sub>1]
goal (9 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
5. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
7. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
have "is_cupcake_exp exp\<^sub>1" "is_cupcake_exp exp\<^sub>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. is_cupcake_exp exp\<^sub>1 &&& is_cupcake_exp exp\<^sub>2
[PROOF STEP]
using app1
[PROOF STATE]
proof (prove)
using this:
list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev exps) ress
\<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env')); related_exp ?t4 exp'; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) bv
sequence_result ress = Rval ml_vs
do_opapp (rev ml_vs) = Some (env', exp')
cupcake_evaluate_single env' exp' bv
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (exp0.App Opapp exps)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
goal (1 subgoal):
1. is_cupcake_exp exp\<^sub>1 &&& is_cupcake_exp exp\<^sub>2
[PROOF STEP]
unfolding \<open>exps = _\<close>
[PROOF STATE]
proof (prove)
using this:
list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev [exp\<^sub>1, exp\<^sub>2]) ress
\<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env')); related_exp ?t4 exp'; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) bv
sequence_result ress = Rval ml_vs
do_opapp (rev ml_vs) = Some (env', exp')
cupcake_evaluate_single env' exp' bv
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (exp0.App Opapp [exp\<^sub>1, exp\<^sub>2])
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
goal (1 subgoal):
1. is_cupcake_exp exp\<^sub>1 &&& is_cupcake_exp exp\<^sub>2
[PROOF STEP]
by (auto dest: related_exp_is_cupcake)
[PROOF STATE]
proof (state)
this:
is_cupcake_exp exp\<^sub>1
is_cupcake_exp exp\<^sub>2
goal (9 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
5. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
7. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
is_cupcake_exp exp\<^sub>1
is_cupcake_exp exp\<^sub>2
goal (9 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
5. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
7. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
have "fmrel_on_fset (ids t\<^sub>1) related_v \<Gamma> (fmap_of_ns (sem_env.v env))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmrel_on_fset (ids t\<^sub>1) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
[PROOF STEP]
using app1
[PROOF STATE]
proof (prove)
using this:
list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev exps) ress
\<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env')); related_exp ?t4 exp'; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) bv
sequence_result ress = Rval ml_vs
do_opapp (rev ml_vs) = Some (env', exp')
cupcake_evaluate_single env' exp' bv
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (exp0.App Opapp exps)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
goal (1 subgoal):
1. fmrel_on_fset (ids t\<^sub>1) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
[PROOF STEP]
unfolding ids_def \<open>t = _\<close>
[PROOF STATE]
proof (prove)
using this:
list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (frees xa |\<union>| consts xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev exps) ress
\<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (frees ?t4 |\<union>| consts ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env')); related_exp ?t4 exp'; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) bv
sequence_result ress = Rval ml_vs
do_opapp (rev ml_vs) = Some (env', exp')
cupcake_evaluate_single env' exp' bv
is_cupcake_all_env env
fmrel_on_fset (frees (t\<^sub>1 $\<^sub>s t\<^sub>2) |\<union>| consts (t\<^sub>1 $\<^sub>s t\<^sub>2)) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp (t\<^sub>1 $\<^sub>s t\<^sub>2) (exp0.App Opapp exps)
pre_strong_term_class.wellformed (t\<^sub>1 $\<^sub>s t\<^sub>2)
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except (t\<^sub>1 $\<^sub>s t\<^sub>2) (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts (t\<^sub>1 $\<^sub>s t\<^sub>2) |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts (t\<^sub>1 $\<^sub>s t\<^sub>2)
not_shadows_vconsts_env \<Gamma>
goal (1 subgoal):
1. fmrel_on_fset (frees t\<^sub>1 |\<union>| consts t\<^sub>1) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
[PROOF STEP]
by (auto intro: fmrel_on_fsubset)
[PROOF STATE]
proof (state)
this:
fmrel_on_fset (ids t\<^sub>1) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
goal (9 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
5. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
7. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
fmrel_on_fset (ids t\<^sub>1) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
goal (9 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
5. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
7. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
have "fmrel_on_fset (ids t\<^sub>2) related_v \<Gamma> (fmap_of_ns (sem_env.v env))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmrel_on_fset (ids t\<^sub>2) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
[PROOF STEP]
using app1
[PROOF STATE]
proof (prove)
using this:
list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev exps) ress
\<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env')); related_exp ?t4 exp'; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) bv
sequence_result ress = Rval ml_vs
do_opapp (rev ml_vs) = Some (env', exp')
cupcake_evaluate_single env' exp' bv
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (exp0.App Opapp exps)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
goal (1 subgoal):
1. fmrel_on_fset (ids t\<^sub>2) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
[PROOF STEP]
unfolding ids_def \<open>t = _\<close>
[PROOF STATE]
proof (prove)
using this:
list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (frees xa |\<union>| consts xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev exps) ress
\<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (frees ?t4 |\<union>| consts ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env')); related_exp ?t4 exp'; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) bv
sequence_result ress = Rval ml_vs
do_opapp (rev ml_vs) = Some (env', exp')
cupcake_evaluate_single env' exp' bv
is_cupcake_all_env env
fmrel_on_fset (frees (t\<^sub>1 $\<^sub>s t\<^sub>2) |\<union>| consts (t\<^sub>1 $\<^sub>s t\<^sub>2)) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp (t\<^sub>1 $\<^sub>s t\<^sub>2) (exp0.App Opapp exps)
pre_strong_term_class.wellformed (t\<^sub>1 $\<^sub>s t\<^sub>2)
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except (t\<^sub>1 $\<^sub>s t\<^sub>2) (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts (t\<^sub>1 $\<^sub>s t\<^sub>2) |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts (t\<^sub>1 $\<^sub>s t\<^sub>2)
not_shadows_vconsts_env \<Gamma>
goal (1 subgoal):
1. fmrel_on_fset (frees t\<^sub>2 |\<union>| consts t\<^sub>2) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
[PROOF STEP]
by (auto intro: fmrel_on_fsubset)
[PROOF STATE]
proof (state)
this:
fmrel_on_fset (ids t\<^sub>2) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
goal (9 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
5. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
7. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
is_cupcake_exp exp\<^sub>1
is_cupcake_exp exp\<^sub>2
fmrel_on_fset (ids t\<^sub>1) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
fmrel_on_fset (ids t\<^sub>2) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
[PROOF STEP]
have
"cupcake_evaluate_single env exp\<^sub>1 (Rval ml_v\<^sub>1)" "cupcake_evaluate_single env exp\<^sub>2 (Rval ml_v\<^sub>2)" and
"\<exists>t\<^sub>1'. \<Gamma> \<turnstile>\<^sub>v t\<^sub>1 \<down> t\<^sub>1' \<and> related_v t\<^sub>1' ml_v\<^sub>1" "\<exists>t\<^sub>2'. \<Gamma> \<turnstile>\<^sub>v t\<^sub>2 \<down> t\<^sub>2' \<and> related_v t\<^sub>2' ml_v\<^sub>2"
[PROOF STATE]
proof (prove)
using this:
is_cupcake_exp exp\<^sub>1
is_cupcake_exp exp\<^sub>2
fmrel_on_fset (ids t\<^sub>1) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
fmrel_on_fset (ids t\<^sub>2) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
goal (1 subgoal):
1. (cupcake_evaluate_single env exp\<^sub>1 (Rval ml_v\<^sub>1) &&& cupcake_evaluate_single env exp\<^sub>2 (Rval ml_v\<^sub>2)) &&& \<exists>t\<^sub>1'. \<Gamma> \<turnstile>\<^sub>v t\<^sub>1 \<down> t\<^sub>1' \<and> related_v t\<^sub>1' ml_v\<^sub>1 &&& \<exists>t\<^sub>2'. \<Gamma> \<turnstile>\<^sub>v t\<^sub>2 \<down> t\<^sub>2' \<and> related_v t\<^sub>2' ml_v\<^sub>2
[PROOF STEP]
using app1 \<open>related_exp t\<^sub>1 exp\<^sub>1\<close> \<open>related_exp t\<^sub>2 exp\<^sub>2\<close>
[PROOF STATE]
proof (prove)
using this:
is_cupcake_exp exp\<^sub>1
is_cupcake_exp exp\<^sub>2
fmrel_on_fset (ids t\<^sub>1) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
fmrel_on_fset (ids t\<^sub>2) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev exps) ress
\<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env')); related_exp ?t4 exp'; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) bv
sequence_result ress = Rval ml_vs
do_opapp (rev ml_vs) = Some (env', exp')
cupcake_evaluate_single env' exp' bv
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (exp0.App Opapp exps)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
related_exp t\<^sub>1 exp\<^sub>1
related_exp t\<^sub>2 exp\<^sub>2
goal (1 subgoal):
1. (cupcake_evaluate_single env exp\<^sub>1 (Rval ml_v\<^sub>1) &&& cupcake_evaluate_single env exp\<^sub>2 (Rval ml_v\<^sub>2)) &&& \<exists>t\<^sub>1'. \<Gamma> \<turnstile>\<^sub>v t\<^sub>1 \<down> t\<^sub>1' \<and> related_v t\<^sub>1' ml_v\<^sub>1 &&& \<exists>t\<^sub>2'. \<Gamma> \<turnstile>\<^sub>v t\<^sub>2 \<down> t\<^sub>2' \<and> related_v t\<^sub>2' ml_v\<^sub>2
[PROOF STEP]
unfolding \<open>ress = _\<close> \<open>exps = _\<close> \<open>ml_vs = _\<close> \<open>t = _\<close>
[PROOF STATE]
proof (prove)
using this:
is_cupcake_exp exp\<^sub>1
is_cupcake_exp exp\<^sub>2
fmrel_on_fset (ids t\<^sub>1) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
fmrel_on_fset (ids t\<^sub>2) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev [exp\<^sub>1, exp\<^sub>2]) (map Rval [ml_v\<^sub>2, ml_v\<^sub>1])
\<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env')); related_exp ?t4 exp'; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) bv
sequence_result (map Rval [ml_v\<^sub>2, ml_v\<^sub>1]) = Rval [ml_v\<^sub>2, ml_v\<^sub>1]
do_opapp (rev [ml_v\<^sub>2, ml_v\<^sub>1]) = Some (env', exp')
cupcake_evaluate_single env' exp' bv
is_cupcake_all_env env
fmrel_on_fset (ids (t\<^sub>1 $\<^sub>s t\<^sub>2)) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp (t\<^sub>1 $\<^sub>s t\<^sub>2) (exp0.App Opapp [exp\<^sub>1, exp\<^sub>2])
pre_strong_term_class.wellformed (t\<^sub>1 $\<^sub>s t\<^sub>2)
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except (t\<^sub>1 $\<^sub>s t\<^sub>2) (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts (t\<^sub>1 $\<^sub>s t\<^sub>2) |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts (t\<^sub>1 $\<^sub>s t\<^sub>2)
not_shadows_vconsts_env \<Gamma>
related_exp t\<^sub>1 exp\<^sub>1
related_exp t\<^sub>2 exp\<^sub>2
goal (1 subgoal):
1. (cupcake_evaluate_single env exp\<^sub>1 (Rval ml_v\<^sub>1) &&& cupcake_evaluate_single env exp\<^sub>2 (Rval ml_v\<^sub>2)) &&& \<exists>t\<^sub>1'. \<Gamma> \<turnstile>\<^sub>v t\<^sub>1 \<down> t\<^sub>1' \<and> related_v t\<^sub>1' ml_v\<^sub>1 &&& \<exists>t\<^sub>2'. \<Gamma> \<turnstile>\<^sub>v t\<^sub>2 \<down> t\<^sub>2' \<and> related_v t\<^sub>2' ml_v\<^sub>2
[PROOF STEP]
by (auto simp: closed_except_def)
[PROOF STATE]
proof (state)
this:
cupcake_evaluate_single env exp\<^sub>1 (Rval ml_v\<^sub>1)
cupcake_evaluate_single env exp\<^sub>2 (Rval ml_v\<^sub>2)
\<exists>t\<^sub>1'. \<Gamma> \<turnstile>\<^sub>v t\<^sub>1 \<down> t\<^sub>1' \<and> related_v t\<^sub>1' ml_v\<^sub>1
\<exists>t\<^sub>2'. \<Gamma> \<turnstile>\<^sub>v t\<^sub>2 \<down> t\<^sub>2' \<and> related_v t\<^sub>2' ml_v\<^sub>2
goal (9 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
5. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
7. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cupcake_evaluate_single env exp\<^sub>1 (Rval ml_v\<^sub>1)
cupcake_evaluate_single env exp\<^sub>2 (Rval ml_v\<^sub>2)
\<exists>t\<^sub>1'. \<Gamma> \<turnstile>\<^sub>v t\<^sub>1 \<down> t\<^sub>1' \<and> related_v t\<^sub>1' ml_v\<^sub>1
\<exists>t\<^sub>2'. \<Gamma> \<turnstile>\<^sub>v t\<^sub>2 \<down> t\<^sub>2' \<and> related_v t\<^sub>2' ml_v\<^sub>2
[PROOF STEP]
obtain v\<^sub>1 v\<^sub>2
where "\<Gamma> \<turnstile>\<^sub>v t\<^sub>1 \<down> v\<^sub>1" "related_v v\<^sub>1 ml_v\<^sub>1"
and "\<Gamma> \<turnstile>\<^sub>v t\<^sub>2 \<down> v\<^sub>2" "related_v v\<^sub>2 ml_v\<^sub>2"
[PROOF STATE]
proof (prove)
using this:
cupcake_evaluate_single env exp\<^sub>1 (Rval ml_v\<^sub>1)
cupcake_evaluate_single env exp\<^sub>2 (Rval ml_v\<^sub>2)
\<exists>t\<^sub>1'. \<Gamma> \<turnstile>\<^sub>v t\<^sub>1 \<down> t\<^sub>1' \<and> related_v t\<^sub>1' ml_v\<^sub>1
\<exists>t\<^sub>2'. \<Gamma> \<turnstile>\<^sub>v t\<^sub>2 \<down> t\<^sub>2' \<and> related_v t\<^sub>2' ml_v\<^sub>2
goal (1 subgoal):
1. (\<And>v\<^sub>1 v\<^sub>2. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v t\<^sub>1 \<down> v\<^sub>1; related_v v\<^sub>1 ml_v\<^sub>1; \<Gamma> \<turnstile>\<^sub>v t\<^sub>2 \<down> v\<^sub>2; related_v v\<^sub>2 ml_v\<^sub>2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<Gamma> \<turnstile>\<^sub>v t\<^sub>1 \<down> v\<^sub>1
related_v v\<^sub>1 ml_v\<^sub>1
\<Gamma> \<turnstile>\<^sub>v t\<^sub>2 \<down> v\<^sub>2
related_v v\<^sub>2 ml_v\<^sub>2
goal (9 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
5. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
7. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
have "is_cupcake_value ml_v\<^sub>1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. is_cupcake_value ml_v\<^sub>1
[PROOF STEP]
by (rule cupcake_single_preserve) fact+
[PROOF STATE]
proof (state)
this:
is_cupcake_value ml_v\<^sub>1
goal (9 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
5. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
7. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
is_cupcake_value ml_v\<^sub>1
goal (9 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
5. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
7. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
have "is_cupcake_value ml_v\<^sub>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. is_cupcake_value ml_v\<^sub>2
[PROOF STEP]
by (rule cupcake_single_preserve) fact+
[PROOF STATE]
proof (state)
this:
is_cupcake_value ml_v\<^sub>2
goal (9 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
5. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
7. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
is_cupcake_value ml_v\<^sub>1
is_cupcake_value ml_v\<^sub>2
[PROOF STEP]
have "list_all is_cupcake_value (rev ml_vs)"
[PROOF STATE]
proof (prove)
using this:
is_cupcake_value ml_v\<^sub>1
is_cupcake_value ml_v\<^sub>2
goal (1 subgoal):
1. list_all is_cupcake_value (rev ml_vs)
[PROOF STEP]
unfolding \<open>ml_vs = _\<close>
[PROOF STATE]
proof (prove)
using this:
is_cupcake_value ml_v\<^sub>1
is_cupcake_value ml_v\<^sub>2
goal (1 subgoal):
1. list_all is_cupcake_value (rev [ml_v\<^sub>2, ml_v\<^sub>1])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
list_all is_cupcake_value (rev ml_vs)
goal (9 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
5. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
7. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
hence "is_cupcake_exp exp'" "is_cupcake_all_env env'"
[PROOF STATE]
proof (prove)
using this:
list_all is_cupcake_value (rev ml_vs)
goal (1 subgoal):
1. is_cupcake_exp exp' &&& is_cupcake_all_env env'
[PROOF STEP]
using \<open>do_opapp _ = _\<close>
[PROOF STATE]
proof (prove)
using this:
list_all is_cupcake_value (rev ml_vs)
do_opapp (rev ml_vs) = Some (env', exp')
goal (1 subgoal):
1. is_cupcake_exp exp' &&& is_cupcake_all_env env'
[PROOF STEP]
by (metis cupcake_opapp_preserve)+
[PROOF STATE]
proof (state)
this:
is_cupcake_exp exp'
is_cupcake_all_env env'
goal (9 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
5. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
7. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
have "vclosed v\<^sub>1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. vclosed v\<^sub>1
[PROOF STEP]
proof (rule veval'_closed)
[PROOF STATE]
proof (state)
goal (5 subgoals):
1. ?\<Gamma> \<turnstile>\<^sub>v ?t \<down> v\<^sub>1
2. closed_except ?t (fmdom ?\<Gamma>)
3. closed_venv ?\<Gamma>
4. pre_strong_term_class.wellformed ?t
5. wellformed_venv ?\<Gamma>
[PROOF STEP]
show "closed_except t\<^sub>1 (fmdom \<Gamma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. closed_except t\<^sub>1 (fmdom \<Gamma>)
[PROOF STEP]
using \<open>closed_except _ (fmdom \<Gamma>)\<close>
[PROOF STATE]
proof (prove)
using this:
closed_except t (fmdom \<Gamma>)
goal (1 subgoal):
1. closed_except t\<^sub>1 (fmdom \<Gamma>)
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
using this:
closed_except (t\<^sub>1 $\<^sub>s t\<^sub>2) (fmdom \<Gamma>)
goal (1 subgoal):
1. closed_except t\<^sub>1 (fmdom \<Gamma>)
[PROOF STEP]
by (simp add: closed_except_def)
[PROOF STATE]
proof (state)
this:
closed_except t\<^sub>1 (fmdom \<Gamma>)
goal (4 subgoals):
1. \<Gamma> \<turnstile>\<^sub>v t\<^sub>1 \<down> v\<^sub>1
2. closed_venv \<Gamma>
3. pre_strong_term_class.wellformed t\<^sub>1
4. wellformed_venv \<Gamma>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (4 subgoals):
1. \<Gamma> \<turnstile>\<^sub>v t\<^sub>1 \<down> v\<^sub>1
2. closed_venv \<Gamma>
3. pre_strong_term_class.wellformed t\<^sub>1
4. wellformed_venv \<Gamma>
[PROOF STEP]
show "wellformed t\<^sub>1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. pre_strong_term_class.wellformed t\<^sub>1
[PROOF STEP]
using \<open>wellformed t\<close>
[PROOF STATE]
proof (prove)
using this:
pre_strong_term_class.wellformed t
goal (1 subgoal):
1. pre_strong_term_class.wellformed t\<^sub>1
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
using this:
pre_strong_term_class.wellformed (t\<^sub>1 $\<^sub>s t\<^sub>2)
goal (1 subgoal):
1. pre_strong_term_class.wellformed t\<^sub>1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pre_strong_term_class.wellformed t\<^sub>1
goal (3 subgoals):
1. \<Gamma> \<turnstile>\<^sub>v t\<^sub>1 \<down> v\<^sub>1
2. closed_venv \<Gamma>
3. wellformed_venv \<Gamma>
[PROOF STEP]
qed fact+
[PROOF STATE]
proof (state)
this:
vclosed v\<^sub>1
goal (9 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
5. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
7. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
have "vclosed v\<^sub>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. vclosed v\<^sub>2
[PROOF STEP]
apply (rule veval'_closed)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
1. ?\<Gamma> \<turnstile>\<^sub>v ?t \<down> v\<^sub>2
2. closed_except ?t (fmdom ?\<Gamma>)
3. closed_venv ?\<Gamma>
4. pre_strong_term_class.wellformed ?t
5. wellformed_venv ?\<Gamma>
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (4 subgoals):
1. closed_except t\<^sub>2 (fmdom \<Gamma>)
2. closed_venv \<Gamma>
3. pre_strong_term_class.wellformed t\<^sub>2
4. wellformed_venv \<Gamma>
[PROOF STEP]
using app1
[PROOF STATE]
proof (prove)
using this:
list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev exps) ress
\<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env')); related_exp ?t4 exp'; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) bv
sequence_result ress = Rval ml_vs
do_opapp (rev ml_vs) = Some (env', exp')
cupcake_evaluate_single env' exp' bv
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (exp0.App Opapp exps)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
goal (4 subgoals):
1. closed_except t\<^sub>2 (fmdom \<Gamma>)
2. closed_venv \<Gamma>
3. pre_strong_term_class.wellformed t\<^sub>2
4. wellformed_venv \<Gamma>
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
using this:
list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev exps) ress
\<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env')); related_exp ?t4 exp'; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) bv
sequence_result ress = Rval ml_vs
do_opapp (rev ml_vs) = Some (env', exp')
cupcake_evaluate_single env' exp' bv
is_cupcake_all_env env
fmrel_on_fset (ids (t\<^sub>1 $\<^sub>s t\<^sub>2)) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp (t\<^sub>1 $\<^sub>s t\<^sub>2) (exp0.App Opapp exps)
pre_strong_term_class.wellformed (t\<^sub>1 $\<^sub>s t\<^sub>2)
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except (t\<^sub>1 $\<^sub>s t\<^sub>2) (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts (t\<^sub>1 $\<^sub>s t\<^sub>2) |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts (t\<^sub>1 $\<^sub>s t\<^sub>2)
not_shadows_vconsts_env \<Gamma>
goal (4 subgoals):
1. closed_except t\<^sub>2 (fmdom \<Gamma>)
2. closed_venv \<Gamma>
3. pre_strong_term_class.wellformed t\<^sub>2
4. wellformed_venv \<Gamma>
[PROOF STEP]
by (auto simp: closed_except_def)
[PROOF STATE]
proof (state)
this:
vclosed v\<^sub>2
goal (9 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
5. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
7. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
have "vwellformed v\<^sub>1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. vwellformed v\<^sub>1
[PROOF STEP]
apply (rule veval'_wellformed)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. ?\<Gamma> \<turnstile>\<^sub>v ?t \<down> v\<^sub>1
2. pre_strong_term_class.wellformed ?t
3. wellformed_venv ?\<Gamma>
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. pre_strong_term_class.wellformed t\<^sub>1
2. wellformed_venv \<Gamma>
[PROOF STEP]
using app1
[PROOF STATE]
proof (prove)
using this:
list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev exps) ress
\<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env')); related_exp ?t4 exp'; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) bv
sequence_result ress = Rval ml_vs
do_opapp (rev ml_vs) = Some (env', exp')
cupcake_evaluate_single env' exp' bv
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (exp0.App Opapp exps)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
goal (2 subgoals):
1. pre_strong_term_class.wellformed t\<^sub>1
2. wellformed_venv \<Gamma>
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
using this:
list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev exps) ress
\<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env')); related_exp ?t4 exp'; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) bv
sequence_result ress = Rval ml_vs
do_opapp (rev ml_vs) = Some (env', exp')
cupcake_evaluate_single env' exp' bv
is_cupcake_all_env env
fmrel_on_fset (ids (t\<^sub>1 $\<^sub>s t\<^sub>2)) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp (t\<^sub>1 $\<^sub>s t\<^sub>2) (exp0.App Opapp exps)
pre_strong_term_class.wellformed (t\<^sub>1 $\<^sub>s t\<^sub>2)
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except (t\<^sub>1 $\<^sub>s t\<^sub>2) (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts (t\<^sub>1 $\<^sub>s t\<^sub>2) |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts (t\<^sub>1 $\<^sub>s t\<^sub>2)
not_shadows_vconsts_env \<Gamma>
goal (2 subgoals):
1. pre_strong_term_class.wellformed t\<^sub>1
2. wellformed_venv \<Gamma>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vwellformed v\<^sub>1
goal (9 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
5. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
7. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
have "vwellformed v\<^sub>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. vwellformed v\<^sub>2
[PROOF STEP]
apply (rule veval'_wellformed)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. ?\<Gamma> \<turnstile>\<^sub>v ?t \<down> v\<^sub>2
2. pre_strong_term_class.wellformed ?t
3. wellformed_venv ?\<Gamma>
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. pre_strong_term_class.wellformed t\<^sub>2
2. wellformed_venv \<Gamma>
[PROOF STEP]
using app1
[PROOF STATE]
proof (prove)
using this:
list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev exps) ress
\<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env')); related_exp ?t4 exp'; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) bv
sequence_result ress = Rval ml_vs
do_opapp (rev ml_vs) = Some (env', exp')
cupcake_evaluate_single env' exp' bv
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (exp0.App Opapp exps)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
goal (2 subgoals):
1. pre_strong_term_class.wellformed t\<^sub>2
2. wellformed_venv \<Gamma>
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
using this:
list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev exps) ress
\<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env')); related_exp ?t4 exp'; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) bv
sequence_result ress = Rval ml_vs
do_opapp (rev ml_vs) = Some (env', exp')
cupcake_evaluate_single env' exp' bv
is_cupcake_all_env env
fmrel_on_fset (ids (t\<^sub>1 $\<^sub>s t\<^sub>2)) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp (t\<^sub>1 $\<^sub>s t\<^sub>2) (exp0.App Opapp exps)
pre_strong_term_class.wellformed (t\<^sub>1 $\<^sub>s t\<^sub>2)
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except (t\<^sub>1 $\<^sub>s t\<^sub>2) (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts (t\<^sub>1 $\<^sub>s t\<^sub>2) |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts (t\<^sub>1 $\<^sub>s t\<^sub>2)
not_shadows_vconsts_env \<Gamma>
goal (2 subgoals):
1. pre_strong_term_class.wellformed t\<^sub>2
2. wellformed_venv \<Gamma>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vwellformed v\<^sub>2
goal (9 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
5. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
7. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
have "vwelldefined' v\<^sub>1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. vwelldefined' v\<^sub>1
[PROOF STEP]
apply (rule veval'_welldefined')
[PROOF STATE]
proof (prove)
goal (8 subgoals):
1. ?\<Gamma> \<turnstile>\<^sub>v ?t \<down> v\<^sub>1
2. fdisjnt C (fmdom ?\<Gamma>)
3. consts ?t |\<subseteq>| fmdom ?\<Gamma> |\<union>| C
4. fmpred (\<lambda>_. vwelldefined') ?\<Gamma>
5. pre_strong_term_class.wellformed ?t
6. wellformed_venv ?\<Gamma>
7. \<not> shadows_consts ?t
8. not_shadows_vconsts_env ?\<Gamma>
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (7 subgoals):
1. fdisjnt C (fmdom \<Gamma>)
2. consts t\<^sub>1 |\<subseteq>| fmdom \<Gamma> |\<union>| C
3. fmpred (\<lambda>_. vwelldefined') \<Gamma>
4. pre_strong_term_class.wellformed t\<^sub>1
5. wellformed_venv \<Gamma>
6. \<not> shadows_consts t\<^sub>1
7. not_shadows_vconsts_env \<Gamma>
[PROOF STEP]
using app1
[PROOF STATE]
proof (prove)
using this:
list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev exps) ress
\<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env')); related_exp ?t4 exp'; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) bv
sequence_result ress = Rval ml_vs
do_opapp (rev ml_vs) = Some (env', exp')
cupcake_evaluate_single env' exp' bv
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (exp0.App Opapp exps)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
goal (7 subgoals):
1. fdisjnt C (fmdom \<Gamma>)
2. consts t\<^sub>1 |\<subseteq>| fmdom \<Gamma> |\<union>| C
3. fmpred (\<lambda>_. vwelldefined') \<Gamma>
4. pre_strong_term_class.wellformed t\<^sub>1
5. wellformed_venv \<Gamma>
6. \<not> shadows_consts t\<^sub>1
7. not_shadows_vconsts_env \<Gamma>
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
using this:
list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev exps) ress
\<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env')); related_exp ?t4 exp'; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) bv
sequence_result ress = Rval ml_vs
do_opapp (rev ml_vs) = Some (env', exp')
cupcake_evaluate_single env' exp' bv
is_cupcake_all_env env
fmrel_on_fset (ids (t\<^sub>1 $\<^sub>s t\<^sub>2)) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp (t\<^sub>1 $\<^sub>s t\<^sub>2) (exp0.App Opapp exps)
pre_strong_term_class.wellformed (t\<^sub>1 $\<^sub>s t\<^sub>2)
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except (t\<^sub>1 $\<^sub>s t\<^sub>2) (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts (t\<^sub>1 $\<^sub>s t\<^sub>2) |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts (t\<^sub>1 $\<^sub>s t\<^sub>2)
not_shadows_vconsts_env \<Gamma>
goal (7 subgoals):
1. fdisjnt C (fmdom \<Gamma>)
2. consts t\<^sub>1 |\<subseteq>| fmdom \<Gamma> |\<union>| C
3. fmpred (\<lambda>_. vwelldefined') \<Gamma>
4. pre_strong_term_class.wellformed t\<^sub>1
5. wellformed_venv \<Gamma>
6. \<not> shadows_consts t\<^sub>1
7. not_shadows_vconsts_env \<Gamma>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vwelldefined' v\<^sub>1
goal (9 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
5. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
7. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
have "vwelldefined' v\<^sub>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. vwelldefined' v\<^sub>2
[PROOF STEP]
apply (rule veval'_welldefined')
[PROOF STATE]
proof (prove)
goal (8 subgoals):
1. ?\<Gamma> \<turnstile>\<^sub>v ?t \<down> v\<^sub>2
2. fdisjnt C (fmdom ?\<Gamma>)
3. consts ?t |\<subseteq>| fmdom ?\<Gamma> |\<union>| C
4. fmpred (\<lambda>_. vwelldefined') ?\<Gamma>
5. pre_strong_term_class.wellformed ?t
6. wellformed_venv ?\<Gamma>
7. \<not> shadows_consts ?t
8. not_shadows_vconsts_env ?\<Gamma>
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (7 subgoals):
1. fdisjnt C (fmdom \<Gamma>)
2. consts t\<^sub>2 |\<subseteq>| fmdom \<Gamma> |\<union>| C
3. fmpred (\<lambda>_. vwelldefined') \<Gamma>
4. pre_strong_term_class.wellformed t\<^sub>2
5. wellformed_venv \<Gamma>
6. \<not> shadows_consts t\<^sub>2
7. not_shadows_vconsts_env \<Gamma>
[PROOF STEP]
using app1
[PROOF STATE]
proof (prove)
using this:
list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev exps) ress
\<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env')); related_exp ?t4 exp'; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) bv
sequence_result ress = Rval ml_vs
do_opapp (rev ml_vs) = Some (env', exp')
cupcake_evaluate_single env' exp' bv
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (exp0.App Opapp exps)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
goal (7 subgoals):
1. fdisjnt C (fmdom \<Gamma>)
2. consts t\<^sub>2 |\<subseteq>| fmdom \<Gamma> |\<union>| C
3. fmpred (\<lambda>_. vwelldefined') \<Gamma>
4. pre_strong_term_class.wellformed t\<^sub>2
5. wellformed_venv \<Gamma>
6. \<not> shadows_consts t\<^sub>2
7. not_shadows_vconsts_env \<Gamma>
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
using this:
list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev exps) ress
\<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env')); related_exp ?t4 exp'; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) bv
sequence_result ress = Rval ml_vs
do_opapp (rev ml_vs) = Some (env', exp')
cupcake_evaluate_single env' exp' bv
is_cupcake_all_env env
fmrel_on_fset (ids (t\<^sub>1 $\<^sub>s t\<^sub>2)) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp (t\<^sub>1 $\<^sub>s t\<^sub>2) (exp0.App Opapp exps)
pre_strong_term_class.wellformed (t\<^sub>1 $\<^sub>s t\<^sub>2)
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except (t\<^sub>1 $\<^sub>s t\<^sub>2) (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts (t\<^sub>1 $\<^sub>s t\<^sub>2) |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts (t\<^sub>1 $\<^sub>s t\<^sub>2)
not_shadows_vconsts_env \<Gamma>
goal (7 subgoals):
1. fdisjnt C (fmdom \<Gamma>)
2. consts t\<^sub>2 |\<subseteq>| fmdom \<Gamma> |\<union>| C
3. fmpred (\<lambda>_. vwelldefined') \<Gamma>
4. pre_strong_term_class.wellformed t\<^sub>2
5. wellformed_venv \<Gamma>
6. \<not> shadows_consts t\<^sub>2
7. not_shadows_vconsts_env \<Gamma>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vwelldefined' v\<^sub>2
goal (9 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
5. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
7. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
have "not_shadows_vconsts v\<^sub>1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. not_shadows_vconsts v\<^sub>1
[PROOF STEP]
apply (rule veval'_shadows)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. ?\<Gamma> \<turnstile>\<^sub>v ?t \<down> v\<^sub>1
2. not_shadows_vconsts_env ?\<Gamma>
3. \<not> shadows_consts ?t
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. not_shadows_vconsts_env \<Gamma>
2. \<not> shadows_consts t\<^sub>1
[PROOF STEP]
using app1
[PROOF STATE]
proof (prove)
using this:
list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev exps) ress
\<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env')); related_exp ?t4 exp'; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) bv
sequence_result ress = Rval ml_vs
do_opapp (rev ml_vs) = Some (env', exp')
cupcake_evaluate_single env' exp' bv
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (exp0.App Opapp exps)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
goal (2 subgoals):
1. not_shadows_vconsts_env \<Gamma>
2. \<not> shadows_consts t\<^sub>1
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
using this:
list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev exps) ress
\<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env')); related_exp ?t4 exp'; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) bv
sequence_result ress = Rval ml_vs
do_opapp (rev ml_vs) = Some (env', exp')
cupcake_evaluate_single env' exp' bv
is_cupcake_all_env env
fmrel_on_fset (ids (t\<^sub>1 $\<^sub>s t\<^sub>2)) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp (t\<^sub>1 $\<^sub>s t\<^sub>2) (exp0.App Opapp exps)
pre_strong_term_class.wellformed (t\<^sub>1 $\<^sub>s t\<^sub>2)
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except (t\<^sub>1 $\<^sub>s t\<^sub>2) (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts (t\<^sub>1 $\<^sub>s t\<^sub>2) |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts (t\<^sub>1 $\<^sub>s t\<^sub>2)
not_shadows_vconsts_env \<Gamma>
goal (2 subgoals):
1. not_shadows_vconsts_env \<Gamma>
2. \<not> shadows_consts t\<^sub>1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
not_shadows_vconsts v\<^sub>1
goal (9 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
5. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
7. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
have "not_shadows_vconsts v\<^sub>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. not_shadows_vconsts v\<^sub>2
[PROOF STEP]
apply (rule veval'_shadows)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. ?\<Gamma> \<turnstile>\<^sub>v ?t \<down> v\<^sub>2
2. not_shadows_vconsts_env ?\<Gamma>
3. \<not> shadows_consts ?t
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. not_shadows_vconsts_env \<Gamma>
2. \<not> shadows_consts t\<^sub>2
[PROOF STEP]
using app1
[PROOF STATE]
proof (prove)
using this:
list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev exps) ress
\<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env')); related_exp ?t4 exp'; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) bv
sequence_result ress = Rval ml_vs
do_opapp (rev ml_vs) = Some (env', exp')
cupcake_evaluate_single env' exp' bv
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (exp0.App Opapp exps)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
goal (2 subgoals):
1. not_shadows_vconsts_env \<Gamma>
2. \<not> shadows_consts t\<^sub>2
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
using this:
list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev exps) ress
\<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env')); related_exp ?t4 exp'; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) bv
sequence_result ress = Rval ml_vs
do_opapp (rev ml_vs) = Some (env', exp')
cupcake_evaluate_single env' exp' bv
is_cupcake_all_env env
fmrel_on_fset (ids (t\<^sub>1 $\<^sub>s t\<^sub>2)) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp (t\<^sub>1 $\<^sub>s t\<^sub>2) (exp0.App Opapp exps)
pre_strong_term_class.wellformed (t\<^sub>1 $\<^sub>s t\<^sub>2)
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except (t\<^sub>1 $\<^sub>s t\<^sub>2) (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts (t\<^sub>1 $\<^sub>s t\<^sub>2) |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts (t\<^sub>1 $\<^sub>s t\<^sub>2)
not_shadows_vconsts_env \<Gamma>
goal (2 subgoals):
1. not_shadows_vconsts_env \<Gamma>
2. \<not> shadows_consts t\<^sub>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
not_shadows_vconsts v\<^sub>2
goal (9 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs env' e bv \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = Some (env', e); cupcake_evaluate_single env' e bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env'; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env')); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
5. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
6. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
7. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
8. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
9. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
[PROOF STEP]
proof (rule if_rvalI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<And>v. bv = Rval v \<Longrightarrow> \<exists>va. \<Gamma> \<turnstile>\<^sub>v t \<down> va \<and> related_v va v
[PROOF STEP]
fix ml_v
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<And>v. bv = Rval v \<Longrightarrow> \<exists>va. \<Gamma> \<turnstile>\<^sub>v t \<down> va \<and> related_v va v
[PROOF STEP]
assume "bv = Rval ml_v"
[PROOF STATE]
proof (state)
this:
bv = Rval ml_v
goal (1 subgoal):
1. \<And>v. bv = Rval v \<Longrightarrow> \<exists>va. \<Gamma> \<turnstile>\<^sub>v t \<down> va \<and> related_v va v
[PROOF STEP]
show "\<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
using \<open>do_opapp _ = _\<close>
[PROOF STATE]
proof (prove)
using this:
do_opapp (rev ml_vs) = Some (env', exp')
goal (1 subgoal):
1. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
proof (cases rule: do_opapp_cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. \<And>env n v0. \<lbrakk>rev ml_vs = [Closure env n exp', v0]; env' = update_v (\<lambda>_. nsBind n v0 (sem_env.v env)) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
2. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
case (closure env\<^sub>\<Lambda> n)
[PROOF STATE]
proof (state)
this:
rev ml_vs = [Closure env\<^sub>\<Lambda> n exp', v0_]
env' = update_v (\<lambda>_. nsBind n v0_ (sem_env.v env\<^sub>\<Lambda>)) env\<^sub>\<Lambda>
goal (2 subgoals):
1. \<And>env n v0. \<lbrakk>rev ml_vs = [Closure env n exp', v0]; env' = update_v (\<lambda>_. nsBind n v0 (sem_env.v env)) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
2. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
rev ml_vs = [Closure env\<^sub>\<Lambda> n exp', v0_]
env' = update_v (\<lambda>_. nsBind n v0_ (sem_env.v env\<^sub>\<Lambda>)) env\<^sub>\<Lambda>
[PROOF STEP]
have closure':
"ml_v\<^sub>1 = Closure env\<^sub>\<Lambda> (as_string (Name n)) exp'"
"env' = update_v (\<lambda>_. nsBind (as_string (Name n)) ml_v\<^sub>2 (sem_env.v env\<^sub>\<Lambda>)) env\<^sub>\<Lambda>"
[PROOF STATE]
proof (prove)
using this:
rev ml_vs = [Closure env\<^sub>\<Lambda> n exp', v0_]
env' = update_v (\<lambda>_. nsBind n v0_ (sem_env.v env\<^sub>\<Lambda>)) env\<^sub>\<Lambda>
goal (1 subgoal):
1. ml_v\<^sub>1 = Closure env\<^sub>\<Lambda> (as_string (Name n)) exp' &&& env' = update_v (\<lambda>_. nsBind (as_string (Name n)) ml_v\<^sub>2 (sem_env.v env\<^sub>\<Lambda>)) env\<^sub>\<Lambda>
[PROOF STEP]
unfolding \<open>ml_vs = _\<close>
[PROOF STATE]
proof (prove)
using this:
rev [ml_v\<^sub>2, ml_v\<^sub>1] = [Closure env\<^sub>\<Lambda> n exp', v0_]
env' = update_v (\<lambda>_. nsBind n v0_ (sem_env.v env\<^sub>\<Lambda>)) env\<^sub>\<Lambda>
goal (1 subgoal):
1. ml_v\<^sub>1 = Closure env\<^sub>\<Lambda> (as_string (Name n)) exp' &&& env' = update_v (\<lambda>_. nsBind (as_string (Name n)) ml_v\<^sub>2 (sem_env.v env\<^sub>\<Lambda>)) env\<^sub>\<Lambda>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ml_v\<^sub>1 = Closure env\<^sub>\<Lambda> (as_string (Name n)) exp'
env' = update_v (\<lambda>_. nsBind (as_string (Name n)) ml_v\<^sub>2 (sem_env.v env\<^sub>\<Lambda>)) env\<^sub>\<Lambda>
goal (2 subgoals):
1. \<And>env n v0. \<lbrakk>rev ml_vs = [Closure env n exp', v0]; env' = update_v (\<lambda>_. nsBind n v0 (sem_env.v env)) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
2. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
obtain \<Gamma>\<^sub>\<Lambda> cs
where "v\<^sub>1 = Vabs cs \<Gamma>\<^sub>\<Lambda>" "related_fun cs (Name n) exp'"
and "fmrel_on_fset (ids (Sabs cs)) related_v \<Gamma>\<^sub>\<Lambda> (fmap_of_ns (sem_env.v env\<^sub>\<Lambda>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<And>cs \<Gamma>\<^sub>\<Lambda>. \<lbrakk>v\<^sub>1 = Vabs cs \<Gamma>\<^sub>\<Lambda>; related_fun cs (Name n) exp'; fmrel_on_fset (ids (Sabs cs)) related_v \<Gamma>\<^sub>\<Lambda> (fmap_of_ns (sem_env.v env\<^sub>\<Lambda>))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>related_v v\<^sub>1 ml_v\<^sub>1\<close>
[PROOF STATE]
proof (prove)
using this:
related_v v\<^sub>1 ml_v\<^sub>1
goal (1 subgoal):
1. (\<And>cs \<Gamma>\<^sub>\<Lambda>. \<lbrakk>v\<^sub>1 = Vabs cs \<Gamma>\<^sub>\<Lambda>; related_fun cs (Name n) exp'; fmrel_on_fset (ids (Sabs cs)) related_v \<Gamma>\<^sub>\<Lambda> (fmap_of_ns (sem_env.v env\<^sub>\<Lambda>))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding \<open>ml_v\<^sub>1 = _\<close>
[PROOF STATE]
proof (prove)
using this:
related_v v\<^sub>1 (Closure env\<^sub>\<Lambda> (as_string (Name n)) exp')
goal (1 subgoal):
1. (\<And>cs \<Gamma>\<^sub>\<Lambda>. \<lbrakk>v\<^sub>1 = Vabs cs \<Gamma>\<^sub>\<Lambda>; related_fun cs (Name n) exp'; fmrel_on_fset (ids (Sabs cs)) related_v \<Gamma>\<^sub>\<Lambda> (fmap_of_ns (sem_env.v env\<^sub>\<Lambda>))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by cases auto
[PROOF STATE]
proof (state)
this:
v\<^sub>1 = Vabs cs \<Gamma>\<^sub>\<Lambda>
related_fun cs (Name n) exp'
fmrel_on_fset (ids (Sabs cs)) related_v \<Gamma>\<^sub>\<Lambda> (fmap_of_ns (sem_env.v env\<^sub>\<Lambda>))
goal (2 subgoals):
1. \<And>env n v0. \<lbrakk>rev ml_vs = [Closure env n exp', v0]; env' = update_v (\<lambda>_. nsBind n v0 (sem_env.v env)) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
2. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
v\<^sub>1 = Vabs cs \<Gamma>\<^sub>\<Lambda>
related_fun cs (Name n) exp'
fmrel_on_fset (ids (Sabs cs)) related_v \<Gamma>\<^sub>\<Lambda> (fmap_of_ns (sem_env.v env\<^sub>\<Lambda>))
[PROOF STEP]
obtain ml_cs
where "exp' = Mat (Var (Short (as_string (Name n)))) ml_cs" "Name n |\<notin>| ids (Sabs cs)" "Name n |\<notin>| all_consts"
and "list_all2 (rel_prod related_pat related_exp) cs ml_cs"
[PROOF STATE]
proof (prove)
using this:
v\<^sub>1 = Vabs cs \<Gamma>\<^sub>\<Lambda>
related_fun cs (Name n) exp'
fmrel_on_fset (ids (Sabs cs)) related_v \<Gamma>\<^sub>\<Lambda> (fmap_of_ns (sem_env.v env\<^sub>\<Lambda>))
goal (1 subgoal):
1. (\<And>ml_cs. \<lbrakk>exp' = Mat (Var (Short (as_string (Name n)))) ml_cs; Name n |\<notin>| ids (Sabs cs); Name n |\<notin>| all_consts; list_all2 (rel_prod related_pat related_exp) cs ml_cs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto elim: related_funE)
[PROOF STATE]
proof (state)
this:
exp' = Mat (Var (Short (as_string (Name n)))) ml_cs
Name n |\<notin>| ids (Sabs cs)
Name n |\<notin>| all_consts
list_all2 (rel_prod related_pat related_exp) cs ml_cs
goal (2 subgoals):
1. \<And>env n v0. \<lbrakk>rev ml_vs = [Closure env n exp', v0]; env' = update_v (\<lambda>_. nsBind n v0 (sem_env.v env)) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
2. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
hence "cupcake_evaluate_single env' (Mat (Var (Short (as_string (Name n)))) ml_cs) (Rval ml_v)"
[PROOF STATE]
proof (prove)
using this:
exp' = Mat (Var (Short (as_string (Name n)))) ml_cs
Name n |\<notin>| ids (Sabs cs)
Name n |\<notin>| all_consts
list_all2 (rel_prod related_pat related_exp) cs ml_cs
goal (1 subgoal):
1. cupcake_evaluate_single env' (Mat (Var (Short (as_string (Name n)))) ml_cs) (Rval ml_v)
[PROOF STEP]
using \<open>cupcake_evaluate_single env' exp' bv\<close>
[PROOF STATE]
proof (prove)
using this:
exp' = Mat (Var (Short (as_string (Name n)))) ml_cs
Name n |\<notin>| ids (Sabs cs)
Name n |\<notin>| all_consts
list_all2 (rel_prod related_pat related_exp) cs ml_cs
cupcake_evaluate_single env' exp' bv
goal (1 subgoal):
1. cupcake_evaluate_single env' (Mat (Var (Short (as_string (Name n)))) ml_cs) (Rval ml_v)
[PROOF STEP]
unfolding \<open>bv = _\<close>
[PROOF STATE]
proof (prove)
using this:
exp' = Mat (Var (Short (as_string (Name n)))) ml_cs
Name n |\<notin>| ids (Sabs cs)
Name n |\<notin>| all_consts
list_all2 (rel_prod related_pat related_exp) cs ml_cs
cupcake_evaluate_single env' exp' (Rval ml_v)
goal (1 subgoal):
1. cupcake_evaluate_single env' (Mat (Var (Short (as_string (Name n)))) ml_cs) (Rval ml_v)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cupcake_evaluate_single env' (Mat (Var (Short (as_string (Name n)))) ml_cs) (Rval ml_v)
goal (2 subgoals):
1. \<And>env n v0. \<lbrakk>rev ml_vs = [Closure env n exp', v0]; env' = update_v (\<lambda>_. nsBind n v0 (sem_env.v env)) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
2. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cupcake_evaluate_single env' (Mat (Var (Short (as_string (Name n)))) ml_cs) (Rval ml_v)
[PROOF STEP]
obtain m_env v' ml_rhs ml_pat
where "cupcake_evaluate_single env' (Var (Short (as_string (Name n)))) (Rval v')"
and "cupcake_match_result (sem_env.c env') v' ml_cs Bindv = Rval (ml_rhs, ml_pat, m_env)"
and "cupcake_evaluate_single (env' \<lparr> sem_env.v := nsAppend (alist_to_ns m_env) (sem_env.v env') \<rparr>) ml_rhs (Rval ml_v)"
[PROOF STATE]
proof (prove)
using this:
cupcake_evaluate_single env' (Mat (Var (Short (as_string (Name n)))) ml_cs) (Rval ml_v)
goal (1 subgoal):
1. (\<And>v' ml_rhs ml_pat m_env. \<lbrakk>cupcake_evaluate_single env' (Var (Short (as_string (Name n)))) (Rval v'); cupcake_match_result (sem_env.c env') v' ml_cs Bindv = Rval (ml_rhs, ml_pat, m_env); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns m_env) (sem_env.v env')) env') ml_rhs (Rval ml_v)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by cases auto
[PROOF STATE]
proof (state)
this:
cupcake_evaluate_single env' (Var (Short (as_string (Name n)))) (Rval v')
cupcake_match_result (sem_env.c env') v' ml_cs Bindv = Rval (ml_rhs, ml_pat, m_env)
cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns m_env) (sem_env.v env')) env') ml_rhs (Rval ml_v)
goal (2 subgoals):
1. \<And>env n v0. \<lbrakk>rev ml_vs = [Closure env n exp', v0]; env' = update_v (\<lambda>_. nsBind n v0 (sem_env.v env)) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
2. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
have
"closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)" "wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)"
"not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)" "fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) &&& wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)) &&& not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) &&& fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
[PROOF STEP]
using \<open>vclosed v\<^sub>1\<close> \<open>vclosed v\<^sub>2\<close>
[PROOF STATE]
proof (prove)
using this:
vclosed v\<^sub>1
vclosed v\<^sub>2
goal (1 subgoal):
1. (closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) &&& wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)) &&& not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) &&& fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
[PROOF STEP]
using \<open>vwellformed v\<^sub>1\<close> \<open>vwellformed v\<^sub>2\<close>
[PROOF STATE]
proof (prove)
using this:
vclosed v\<^sub>1
vclosed v\<^sub>2
vwellformed v\<^sub>1
vwellformed v\<^sub>2
goal (1 subgoal):
1. (closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) &&& wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)) &&& not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) &&& fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
[PROOF STEP]
using \<open>not_shadows_vconsts v\<^sub>1\<close> \<open>not_shadows_vconsts v\<^sub>2\<close>
[PROOF STATE]
proof (prove)
using this:
vclosed v\<^sub>1
vclosed v\<^sub>2
vwellformed v\<^sub>1
vwellformed v\<^sub>2
not_shadows_vconsts v\<^sub>1
not_shadows_vconsts v\<^sub>2
goal (1 subgoal):
1. (closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) &&& wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)) &&& not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) &&& fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
[PROOF STEP]
using \<open>vwelldefined' v\<^sub>1\<close> \<open>vwelldefined' v\<^sub>2\<close>
[PROOF STATE]
proof (prove)
using this:
vclosed v\<^sub>1
vclosed v\<^sub>2
vwellformed v\<^sub>1
vwellformed v\<^sub>2
not_shadows_vconsts v\<^sub>1
not_shadows_vconsts v\<^sub>2
vwelldefined' v\<^sub>1
vwelldefined' v\<^sub>2
goal (1 subgoal):
1. (closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) &&& wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)) &&& not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) &&& fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
[PROOF STEP]
unfolding \<open>v\<^sub>1 = _\<close>
[PROOF STATE]
proof (prove)
using this:
vclosed (Vabs cs \<Gamma>\<^sub>\<Lambda>)
vclosed v\<^sub>2
vwellformed (Vabs cs \<Gamma>\<^sub>\<Lambda>)
vwellformed v\<^sub>2
not_shadows_vconsts (Vabs cs \<Gamma>\<^sub>\<Lambda>)
not_shadows_vconsts v\<^sub>2
vwelldefined' (Vabs cs \<Gamma>\<^sub>\<Lambda>)
vwelldefined' v\<^sub>2
goal (1 subgoal):
1. (closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) &&& wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)) &&& not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) &&& fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
goal (2 subgoals):
1. \<And>env n v0. \<lbrakk>rev ml_vs = [Closure env n exp', v0]; env' = update_v (\<lambda>_. nsBind n v0 (sem_env.v env)) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
2. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
have "closed_except (Sabs cs) (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. closed_except (Sabs cs) (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
using \<open>vclosed v\<^sub>1\<close>
[PROOF STATE]
proof (prove)
using this:
vclosed v\<^sub>1
goal (1 subgoal):
1. closed_except (Sabs cs) (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
unfolding \<open>v\<^sub>1 = _\<close>
[PROOF STATE]
proof (prove)
using this:
vclosed (Vabs cs \<Gamma>\<^sub>\<Lambda>)
goal (1 subgoal):
1. closed_except (Sabs cs) (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
apply (auto simp: Sterm.closed_except_simps list_all_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<And>a b. \<lbrakk>(a, b) \<in> set cs; closed_venv \<Gamma>\<^sub>\<Lambda>; \<forall>x\<in>set cs. case x of (pat, t) \<Rightarrow> closed_except t (fmdom \<Gamma>\<^sub>\<Lambda> |\<union>| frees pat)\<rbrakk> \<Longrightarrow> closed_except b (finsert (Name n) (fmdom \<Gamma>\<^sub>\<Lambda> |\<union>| frees a))
[PROOF STEP]
apply (auto simp: closed_except_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
closed_except (Sabs cs) (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
goal (2 subgoals):
1. \<And>env n v0. \<lbrakk>rev ml_vs = [Closure env n exp', v0]; env' = update_v (\<lambda>_. nsBind n v0 (sem_env.v env)) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
2. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
have "consts (Sabs cs) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. consts (Sabs cs) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| C
[PROOF STEP]
using \<open>vwelldefined' v\<^sub>1\<close>
[PROOF STATE]
proof (prove)
using this:
vwelldefined' v\<^sub>1
goal (1 subgoal):
1. consts (Sabs cs) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| C
[PROOF STEP]
unfolding \<open>v\<^sub>1 = _\<close>
[PROOF STATE]
proof (prove)
using this:
vwelldefined' (Vabs cs \<Gamma>\<^sub>\<Lambda>)
goal (1 subgoal):
1. consts (Sabs cs) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| C
[PROOF STEP]
unfolding sconsts_sabs
[PROOF STATE]
proof (prove)
using this:
vwelldefined' (Vabs cs \<Gamma>\<^sub>\<Lambda>)
goal (1 subgoal):
1. list_all (\<lambda>(uu_, t). consts t |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| C) cs
[PROOF STEP]
by (auto simp: list_all_iff)
[PROOF STATE]
proof (state)
this:
consts (Sabs cs) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| C
goal (2 subgoals):
1. \<And>env n v0. \<lbrakk>rev ml_vs = [Closure env n exp', v0]; env' = update_v (\<lambda>_. nsBind n v0 (sem_env.v env)) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
2. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
have "\<not> shadows_consts (Sabs cs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<not> shadows_consts (Sabs cs)
[PROOF STEP]
using \<open>not_shadows_vconsts v\<^sub>1\<close>
[PROOF STATE]
proof (prove)
using this:
not_shadows_vconsts v\<^sub>1
goal (1 subgoal):
1. \<not> shadows_consts (Sabs cs)
[PROOF STEP]
unfolding \<open>v\<^sub>1 = _\<close>
[PROOF STATE]
proof (prove)
using this:
not_shadows_vconsts (Vabs cs \<Gamma>\<^sub>\<Lambda>)
goal (1 subgoal):
1. \<not> shadows_consts (Sabs cs)
[PROOF STEP]
by (auto simp: list_all_iff list_ex_iff)
[PROOF STATE]
proof (state)
this:
\<not> shadows_consts (Sabs cs)
goal (2 subgoals):
1. \<And>env n v0. \<lbrakk>rev ml_vs = [Closure env n exp', v0]; env' = update_v (\<lambda>_. nsBind n v0 (sem_env.v env)) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
2. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
have "fdisjnt C (fmdom \<Gamma>\<^sub>\<Lambda>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fdisjnt C (fmdom \<Gamma>\<^sub>\<Lambda>)
[PROOF STEP]
using \<open>vwelldefined' v\<^sub>1\<close>
[PROOF STATE]
proof (prove)
using this:
vwelldefined' v\<^sub>1
goal (1 subgoal):
1. fdisjnt C (fmdom \<Gamma>\<^sub>\<Lambda>)
[PROOF STEP]
unfolding \<open>v\<^sub>1 = _\<close>
[PROOF STATE]
proof (prove)
using this:
vwelldefined' (Vabs cs \<Gamma>\<^sub>\<Lambda>)
goal (1 subgoal):
1. fdisjnt C (fmdom \<Gamma>\<^sub>\<Lambda>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fdisjnt C (fmdom \<Gamma>\<^sub>\<Lambda>)
goal (2 subgoals):
1. \<And>env n v0. \<lbrakk>rev ml_vs = [Closure env n exp', v0]; env' = update_v (\<lambda>_. nsBind n v0 (sem_env.v env)) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
2. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
have "if_rval (\<lambda>ml_v. \<exists>v. fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> \<turnstile>\<^sub>v Sabs cs $\<^sub>s Svar (Name n) \<down> v \<and> related_v v ml_v) bv"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. if_rval (\<lambda>ml_v. \<exists>v. fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> \<turnstile>\<^sub>v Sabs cs $\<^sub>s Svar (Name n) \<down> v \<and> related_v v ml_v) bv
[PROOF STEP]
proof (rule app1(2))
[PROOF STATE]
proof (state)
goal (12 subgoals):
1. is_cupcake_all_env env'
2. fmrel_on_fset (ids (Sabs cs $\<^sub>s Svar (Name n))) related_v (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) (fmap_of_ns (sem_env.v env'))
3. related_exp (Sabs cs $\<^sub>s Svar (Name n)) exp'
4. pre_strong_term_class.wellformed (Sabs cs $\<^sub>s Svar (Name n))
5. wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
6. closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
7. closed_except (Sabs cs $\<^sub>s Svar (Name n)) (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
8. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
9. consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| C
10. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
A total of 12 subgoals...
[PROOF STEP]
show "fmrel_on_fset (ids (Sabs cs $\<^sub>s Svar (Name n))) related_v (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) (fmap_of_ns (sem_env.v env'))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmrel_on_fset (ids (Sabs cs $\<^sub>s Svar (Name n))) related_v (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) (fmap_of_ns (sem_env.v env'))
[PROOF STEP]
unfolding closure'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmrel_on_fset (ids (Sabs cs $\<^sub>s Svar (Name n))) related_v (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsBind (as_string (Name n)) ml_v\<^sub>2 (sem_env.v env\<^sub>\<Lambda>)) env\<^sub>\<Lambda>)))
[PROOF STEP]
apply (simp del: frees_sterm.simps(3) consts_sterm.simps(3) name.sel add: ids_def split!: sem_env.splits)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmrel_on_fset (finsert (Name n) (frees (Sabs cs) |\<union>| consts (Sabs cs))) related_v (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) (fmupd (Name n) ml_v\<^sub>2 (fmap_of_ns (sem_env.v env\<^sub>\<Lambda>)))
[PROOF STEP]
apply (rule fmrel_on_fset_updateI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. fmrel_on_fset (frees (Sabs cs) |\<union>| consts (Sabs cs)) related_v \<Gamma>\<^sub>\<Lambda> (fmap_of_ns (sem_env.v env\<^sub>\<Lambda>))
2. related_v v\<^sub>2 ml_v\<^sub>2
[PROOF STEP]
apply (fold ids_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. fmrel_on_fset (ids (Sabs cs)) related_v \<Gamma>\<^sub>\<Lambda> (fmap_of_ns (sem_env.v env\<^sub>\<Lambda>))
2. related_v v\<^sub>2 ml_v\<^sub>2
[PROOF STEP]
using \<open>fmrel_on_fset (ids (Sabs cs)) related_v \<Gamma>\<^sub>\<Lambda> _\<close>
[PROOF STATE]
proof (prove)
using this:
fmrel_on_fset (ids (Sabs cs)) related_v \<Gamma>\<^sub>\<Lambda> (fmap_of_ns (sem_env.v env\<^sub>\<Lambda>))
goal (2 subgoals):
1. fmrel_on_fset (ids (Sabs cs)) related_v \<Gamma>\<^sub>\<Lambda> (fmap_of_ns (sem_env.v env\<^sub>\<Lambda>))
2. related_v v\<^sub>2 ml_v\<^sub>2
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. related_v v\<^sub>2 ml_v\<^sub>2
[PROOF STEP]
apply (rule \<open>related_v v\<^sub>2 ml_v\<^sub>2\<close>)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
fmrel_on_fset (ids (Sabs cs $\<^sub>s Svar (Name n))) related_v (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) (fmap_of_ns (sem_env.v env'))
goal (11 subgoals):
1. is_cupcake_all_env env'
2. related_exp (Sabs cs $\<^sub>s Svar (Name n)) exp'
3. pre_strong_term_class.wellformed (Sabs cs $\<^sub>s Svar (Name n))
4. wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
5. closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
6. closed_except (Sabs cs $\<^sub>s Svar (Name n)) (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
7. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
8. consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| C
9. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
10. \<not> shadows_consts (Sabs cs $\<^sub>s Svar (Name n))
A total of 11 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (11 subgoals):
1. is_cupcake_all_env env'
2. related_exp (Sabs cs $\<^sub>s Svar (Name n)) exp'
3. pre_strong_term_class.wellformed (Sabs cs $\<^sub>s Svar (Name n))
4. wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
5. closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
6. closed_except (Sabs cs $\<^sub>s Svar (Name n)) (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
7. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
8. consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| C
9. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
10. \<not> shadows_consts (Sabs cs $\<^sub>s Svar (Name n))
A total of 11 subgoals...
[PROOF STEP]
show "wellformed (Sabs cs $\<^sub>s Svar (Name n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. pre_strong_term_class.wellformed (Sabs cs $\<^sub>s Svar (Name n))
[PROOF STEP]
using \<open>vwellformed v\<^sub>1\<close>
[PROOF STATE]
proof (prove)
using this:
vwellformed v\<^sub>1
goal (1 subgoal):
1. pre_strong_term_class.wellformed (Sabs cs $\<^sub>s Svar (Name n))
[PROOF STEP]
unfolding \<open>v\<^sub>1 = _\<close>
[PROOF STATE]
proof (prove)
using this:
vwellformed (Vabs cs \<Gamma>\<^sub>\<Lambda>)
goal (1 subgoal):
1. pre_strong_term_class.wellformed (Sabs cs $\<^sub>s Svar (Name n))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pre_strong_term_class.wellformed (Sabs cs $\<^sub>s Svar (Name n))
goal (10 subgoals):
1. is_cupcake_all_env env'
2. related_exp (Sabs cs $\<^sub>s Svar (Name n)) exp'
3. wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
4. closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
5. closed_except (Sabs cs $\<^sub>s Svar (Name n)) (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
6. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
7. consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| C
8. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
9. \<not> shadows_consts (Sabs cs $\<^sub>s Svar (Name n))
10. not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (10 subgoals):
1. is_cupcake_all_env env'
2. related_exp (Sabs cs $\<^sub>s Svar (Name n)) exp'
3. wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
4. closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
5. closed_except (Sabs cs $\<^sub>s Svar (Name n)) (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
6. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
7. consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| C
8. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
9. \<not> shadows_consts (Sabs cs $\<^sub>s Svar (Name n))
10. not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
[PROOF STEP]
show "related_exp (Sabs cs $\<^sub>s Svar (Name n)) exp'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. related_exp (Sabs cs $\<^sub>s Svar (Name n)) exp'
[PROOF STEP]
unfolding \<open>exp' = _\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. related_exp (Sabs cs $\<^sub>s Svar (Name n)) (Mat (Var (Short (as_string (Name n)))) ml_cs)
[PROOF STEP]
using \<open>list_all2 (rel_prod related_pat related_exp) cs ml_cs\<close>
[PROOF STATE]
proof (prove)
using this:
list_all2 (rel_prod related_pat related_exp) cs ml_cs
goal (1 subgoal):
1. related_exp (Sabs cs $\<^sub>s Svar (Name n)) (Mat (Var (Short (as_string (Name n)))) ml_cs)
[PROOF STEP]
by (auto intro:related_exp.intros simp del: name.sel)
[PROOF STATE]
proof (state)
this:
related_exp (Sabs cs $\<^sub>s Svar (Name n)) exp'
goal (9 subgoals):
1. is_cupcake_all_env env'
2. wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
3. closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
4. closed_except (Sabs cs $\<^sub>s Svar (Name n)) (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
5. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
6. consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| C
7. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
8. \<not> shadows_consts (Sabs cs $\<^sub>s Svar (Name n))
9. not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (9 subgoals):
1. is_cupcake_all_env env'
2. wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
3. closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
4. closed_except (Sabs cs $\<^sub>s Svar (Name n)) (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
5. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
6. consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| C
7. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
8. \<not> shadows_consts (Sabs cs $\<^sub>s Svar (Name n))
9. not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
[PROOF STEP]
show "closed_except (Sabs cs $\<^sub>s Svar (Name n)) (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. closed_except (Sabs cs $\<^sub>s Svar (Name n)) (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
using \<open>closed_except (Sabs cs) (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))\<close>
[PROOF STATE]
proof (prove)
using this:
closed_except (Sabs cs) (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
goal (1 subgoal):
1. closed_except (Sabs cs $\<^sub>s Svar (Name n)) (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
by (simp add: closed_except_def)
[PROOF STATE]
proof (state)
this:
closed_except (Sabs cs $\<^sub>s Svar (Name n)) (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
goal (8 subgoals):
1. is_cupcake_all_env env'
2. wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
3. closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
4. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
5. consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| C
6. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
7. \<not> shadows_consts (Sabs cs $\<^sub>s Svar (Name n))
8. not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (8 subgoals):
1. is_cupcake_all_env env'
2. wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
3. closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
4. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
5. consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| C
6. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
7. \<not> shadows_consts (Sabs cs $\<^sub>s Svar (Name n))
8. not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
[PROOF STEP]
show "\<not> shadows_consts (Sabs cs $\<^sub>s Svar (Name n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<not> shadows_consts (Sabs cs $\<^sub>s Svar (Name n))
[PROOF STEP]
using \<open>\<not> shadows_consts (Sabs cs)\<close> \<open>Name n |\<notin>| all_consts\<close>
[PROOF STATE]
proof (prove)
using this:
\<not> shadows_consts (Sabs cs)
Name n |\<notin>| all_consts
goal (1 subgoal):
1. \<not> shadows_consts (Sabs cs $\<^sub>s Svar (Name n))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<not> shadows_consts (Sabs cs $\<^sub>s Svar (Name n))
goal (7 subgoals):
1. is_cupcake_all_env env'
2. wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
3. closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
4. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
5. consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| C
6. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
7. not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (7 subgoals):
1. is_cupcake_all_env env'
2. wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
3. closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
4. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
5. consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| C
6. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
7. not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
[PROOF STEP]
show "consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| C
[PROOF STEP]
using \<open>consts (Sabs cs) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| C\<close>
[PROOF STATE]
proof (prove)
using this:
consts (Sabs cs) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| C
goal (1 subgoal):
1. consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| C
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| C
goal (6 subgoals):
1. is_cupcake_all_env env'
2. wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
3. closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
4. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
5. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
6. not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (6 subgoals):
1. is_cupcake_all_env env'
2. wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
3. closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
4. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
5. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
6. not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
[PROOF STEP]
show "fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
using \<open>Name n |\<notin>| all_consts\<close> \<open>fdisjnt C (fmdom \<Gamma>\<^sub>\<Lambda>)\<close>
[PROOF STATE]
proof (prove)
using this:
Name n |\<notin>| all_consts
fdisjnt C (fmdom \<Gamma>\<^sub>\<Lambda>)
goal (1 subgoal):
1. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
unfolding fdisjnt_alt_def all_consts_def
[PROOF STATE]
proof (prove)
using this:
Name n |\<notin>| heads |\<union>| C
C |\<inter>| fmdom \<Gamma>\<^sub>\<Lambda> = {||}
goal (1 subgoal):
1. C |\<inter>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) = {||}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
goal (5 subgoals):
1. is_cupcake_all_env env'
2. wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
3. closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
4. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
5. not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
[PROOF STEP]
qed fact+
[PROOF STATE]
proof (state)
this:
if_rval (\<lambda>ml_v. \<exists>v. fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> \<turnstile>\<^sub>v Sabs cs $\<^sub>s Svar (Name n) \<down> v \<and> related_v v ml_v) bv
goal (2 subgoals):
1. \<And>env n v0. \<lbrakk>rev ml_vs = [Closure env n exp', v0]; env' = update_v (\<lambda>_. nsBind n v0 (sem_env.v env)) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
2. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
if_rval (\<lambda>ml_v. \<exists>v. fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> \<turnstile>\<^sub>v Sabs cs $\<^sub>s Svar (Name n) \<down> v \<and> related_v v ml_v) bv
[PROOF STEP]
obtain v where "fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> \<turnstile>\<^sub>v Sabs cs $\<^sub>s Svar (Name n) \<down> v" "related_v v ml_v"
[PROOF STATE]
proof (prove)
using this:
if_rval (\<lambda>ml_v. \<exists>v. fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> \<turnstile>\<^sub>v Sabs cs $\<^sub>s Svar (Name n) \<down> v \<and> related_v v ml_v) bv
goal (1 subgoal):
1. (\<And>v. \<lbrakk>fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> \<turnstile>\<^sub>v Sabs cs $\<^sub>s Svar (Name n) \<down> v; related_v v ml_v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding \<open>bv = _\<close>
[PROOF STATE]
proof (prove)
using this:
if_rval (\<lambda>ml_v. \<exists>v. fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> \<turnstile>\<^sub>v Sabs cs $\<^sub>s Svar (Name n) \<down> v \<and> related_v v ml_v) (Rval ml_v)
goal (1 subgoal):
1. (\<And>v. \<lbrakk>fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> \<turnstile>\<^sub>v Sabs cs $\<^sub>s Svar (Name n) \<down> v; related_v v ml_v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> \<turnstile>\<^sub>v Sabs cs $\<^sub>s Svar (Name n) \<down> v
related_v v ml_v
goal (2 subgoals):
1. \<And>env n v0. \<lbrakk>rev ml_vs = [Closure env n exp', v0]; env' = update_v (\<lambda>_. nsBind n v0 (sem_env.v env)) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
2. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> \<turnstile>\<^sub>v Sabs cs $\<^sub>s Svar (Name n) \<down> v
related_v v ml_v
[PROOF STEP]
obtain env pat rhs
where "vfind_match cs v\<^sub>2 = Some (env, pat, rhs)"
and "fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v"
[PROOF STATE]
proof (prove)
using this:
fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> \<turnstile>\<^sub>v Sabs cs $\<^sub>s Svar (Name n) \<down> v
related_v v ml_v
goal (1 subgoal):
1. (\<And>env pat rhs. \<lbrakk>vfind_match cs v\<^sub>2 = Some (env, pat, rhs); fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto elim: veval'_sabs_svarE)
[PROOF STATE]
proof (state)
this:
vfind_match cs v\<^sub>2 = Some (env, pat, rhs)
fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v
goal (2 subgoals):
1. \<And>env n v0. \<lbrakk>rev ml_vs = [Closure env n exp', v0]; env' = update_v (\<lambda>_. nsBind n v0 (sem_env.v env)) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
2. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
hence "(pat, rhs) \<in> set cs" "vmatch (mk_pat pat) v\<^sub>2 = Some env"
[PROOF STATE]
proof (prove)
using this:
vfind_match cs v\<^sub>2 = Some (env, pat, rhs)
fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v
goal (1 subgoal):
1. (pat, rhs) \<in> set cs &&& vmatch (mk_pat pat) v\<^sub>2 = Some env
[PROOF STEP]
by (metis vfind_match_elem)+
[PROOF STATE]
proof (state)
this:
(pat, rhs) \<in> set cs
vmatch (mk_pat pat) v\<^sub>2 = Some env
goal (2 subgoals):
1. \<And>env n v0. \<lbrakk>rev ml_vs = [Closure env n exp', v0]; env' = update_v (\<lambda>_. nsBind n v0 (sem_env.v env)) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
2. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
hence "linear pat" "wellformed rhs"
[PROOF STATE]
proof (prove)
using this:
(pat, rhs) \<in> set cs
vmatch (mk_pat pat) v\<^sub>2 = Some env
goal (1 subgoal):
1. Pats.linear pat &&& pre_strong_term_class.wellformed rhs
[PROOF STEP]
using \<open>vwellformed v\<^sub>1\<close>
[PROOF STATE]
proof (prove)
using this:
(pat, rhs) \<in> set cs
vmatch (mk_pat pat) v\<^sub>2 = Some env
vwellformed v\<^sub>1
goal (1 subgoal):
1. Pats.linear pat &&& pre_strong_term_class.wellformed rhs
[PROOF STEP]
unfolding \<open>v\<^sub>1 = _\<close>
[PROOF STATE]
proof (prove)
using this:
(pat, rhs) \<in> set cs
vmatch (mk_pat pat) v\<^sub>2 = Some env
vwellformed (Vabs cs \<Gamma>\<^sub>\<Lambda>)
goal (1 subgoal):
1. Pats.linear pat &&& pre_strong_term_class.wellformed rhs
[PROOF STEP]
by (auto simp: list_all_iff)
[PROOF STATE]
proof (state)
this:
Pats.linear pat
pre_strong_term_class.wellformed rhs
goal (2 subgoals):
1. \<And>env n v0. \<lbrakk>rev ml_vs = [Closure env n exp', v0]; env' = update_v (\<lambda>_. nsBind n v0 (sem_env.v env)) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
2. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
hence "frees pat = patvars (mk_pat pat)"
[PROOF STATE]
proof (prove)
using this:
Pats.linear pat
pre_strong_term_class.wellformed rhs
goal (1 subgoal):
1. frees pat = patvars (mk_pat pat)
[PROOF STEP]
by (simp add: mk_pat_frees)
[PROOF STATE]
proof (state)
this:
frees pat = patvars (mk_pat pat)
goal (2 subgoals):
1. \<And>env n v0. \<lbrakk>rev ml_vs = [Closure env n exp', v0]; env' = update_v (\<lambda>_. nsBind n v0 (sem_env.v env)) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
2. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
hence "fmdom env = frees pat"
[PROOF STATE]
proof (prove)
using this:
frees pat = patvars (mk_pat pat)
goal (1 subgoal):
1. fmdom env = frees pat
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. frees pat = patvars (mk_pat pat) \<Longrightarrow> fmdom env = patvars (mk_pat pat)
[PROOF STEP]
apply (rule vmatch_dom)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. frees pat = patvars (mk_pat pat) \<Longrightarrow> vmatch (mk_pat pat) ?v1 = Some env
[PROOF STEP]
apply (rule \<open>vmatch (mk_pat pat) v\<^sub>2 = Some env\<close>)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
fmdom env = frees pat
goal (2 subgoals):
1. \<And>env n v0. \<lbrakk>rev ml_vs = [Closure env n exp', v0]; env' = update_v (\<lambda>_. nsBind n v0 (sem_env.v env)) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
2. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
obtain v' where "\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'" "v' \<approx>\<^sub>e v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof (rule veval'_agree_eq)
[PROOF STATE]
proof (state)
goal (12 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> ?\<Gamma>6 \<turnstile>\<^sub>v ?t6 \<down> ?v6
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmrel_on_fset (ids ?t6) erelated ?\<Gamma>'6 ?\<Gamma>6
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_venv ?\<Gamma>6
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except ?t6 (fmdom ?\<Gamma>6)
5. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed ?t6
6. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> wellformed_venv ?\<Gamma>6
7. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom ?\<Gamma>6)
8. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts ?t6 |\<subseteq>| fmdom ?\<Gamma>6 |\<union>| C
9. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') ?\<Gamma>6
10. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts ?t6
A total of 12 subgoals...
[PROOF STEP]
show "fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v
goal (11 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmrel_on_fset (ids rhs) erelated ?\<Gamma>'6 (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
5. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
6. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
7. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env) |\<union>| C
8. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
9. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
10. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
A total of 11 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (11 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmrel_on_fset (ids rhs) erelated ?\<Gamma>'6 (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
5. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
6. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
7. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env) |\<union>| C
8. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
9. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
10. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
A total of 11 subgoals...
[PROOF STEP]
have *: "Name n |\<notin>| ids rhs" if "Name n |\<notin>| fmdom env"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. Name n |\<notin>| ids rhs
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. Name n |\<in>| ids rhs \<Longrightarrow> False
[PROOF STEP]
assume "Name n |\<in>| ids rhs"
[PROOF STATE]
proof (state)
this:
Name n |\<in>| ids rhs
goal (1 subgoal):
1. Name n |\<in>| ids rhs \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
Name n |\<in>| ids rhs
goal (1 subgoal):
1. False
[PROOF STEP]
unfolding ids_def
[PROOF STATE]
proof (prove)
using this:
Name n |\<in>| frees rhs |\<union>| consts rhs
goal (1 subgoal):
1. False
[PROOF STEP]
proof (cases rule: funion_strictE)
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. Name n |\<in>| frees rhs \<Longrightarrow> False
2. \<lbrakk>Name n |\<notin>| frees rhs; Name n |\<in>| consts rhs\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
case A
[PROOF STATE]
proof (state)
this:
Name n |\<in>| frees rhs
goal (2 subgoals):
1. Name n |\<in>| frees rhs \<Longrightarrow> False
2. \<lbrakk>Name n |\<notin>| frees rhs; Name n |\<in>| consts rhs\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Name n |\<in>| frees rhs
goal (2 subgoals):
1. Name n |\<in>| frees rhs \<Longrightarrow> False
2. \<lbrakk>Name n |\<notin>| frees rhs; Name n |\<in>| consts rhs\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "Name n |\<notin>| frees pat"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. Name n |\<notin>| frees pat
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
Name n |\<notin>| fmdom env
goal (1 subgoal):
1. Name n |\<notin>| frees pat
[PROOF STEP]
unfolding \<open>fmdom env = frees pat\<close>
[PROOF STATE]
proof (prove)
using this:
Name n |\<notin>| frees pat
goal (1 subgoal):
1. Name n |\<notin>| frees pat
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Name n |\<notin>| frees pat
goal (2 subgoals):
1. Name n |\<in>| frees rhs \<Longrightarrow> False
2. \<lbrakk>Name n |\<notin>| frees rhs; Name n |\<in>| consts rhs\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Name n |\<in>| frees rhs
Name n |\<notin>| frees pat
[PROOF STEP]
have "Name n |\<in>| frees (Sabs cs)"
[PROOF STATE]
proof (prove)
using this:
Name n |\<in>| frees rhs
Name n |\<notin>| frees pat
goal (1 subgoal):
1. Name n |\<in>| frees (Sabs cs)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>Name n |\<in>| frees rhs; Name n |\<notin>| frees pat\<rbrakk> \<Longrightarrow> Name n |\<in>| ffUnion ((\<lambda>(pat, rhs). frees rhs |-| frees pat) |`| fset_of_list cs)
[PROOF STEP]
unfolding ffUnion_alt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>Name n |\<in>| frees rhs; Name n |\<notin>| frees pat\<rbrakk> \<Longrightarrow> fBex ((\<lambda>(pat, rhs). frees rhs |-| frees pat) |`| fset_of_list cs) ((|\<in>|) (Name n))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>Name n |\<in>| frees rhs; Name n |\<notin>| frees pat\<rbrakk> \<Longrightarrow> fBex (fset_of_list cs) (\<lambda>x. Name n |\<in>| (case x of (pat, rhs) \<Rightarrow> frees rhs |-| frees pat))
[PROOF STEP]
apply (rule fBexI[where x = "(pat, rhs)"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<lbrakk>Name n |\<in>| frees rhs; Name n |\<notin>| frees pat\<rbrakk> \<Longrightarrow> Name n |\<in>| (case (pat, rhs) of (pat, rhs) \<Rightarrow> frees rhs |-| frees pat)
2. \<lbrakk>Name n |\<in>| frees rhs; Name n |\<notin>| frees pat\<rbrakk> \<Longrightarrow> (pat, rhs) |\<in>| fset_of_list cs
[PROOF STEP]
apply (auto simp: fset_of_list_elem)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>Name n |\<in>| frees rhs; Name n |\<notin>| frees pat\<rbrakk> \<Longrightarrow> (pat, rhs) \<in> set cs
[PROOF STEP]
apply (rule \<open>(pat, rhs) \<in> set cs\<close>)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
Name n |\<in>| frees (Sabs cs)
goal (2 subgoals):
1. Name n |\<in>| frees rhs \<Longrightarrow> False
2. \<lbrakk>Name n |\<notin>| frees rhs; Name n |\<in>| consts rhs\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Name n |\<in>| frees (Sabs cs)
goal (1 subgoal):
1. False
[PROOF STEP]
using \<open>Name n |\<notin>| ids (Sabs cs)\<close>
[PROOF STATE]
proof (prove)
using this:
Name n |\<in>| frees (Sabs cs)
Name n |\<notin>| ids (Sabs cs)
goal (1 subgoal):
1. False
[PROOF STEP]
unfolding ids_def
[PROOF STATE]
proof (prove)
using this:
Name n |\<in>| frees (Sabs cs)
Name n |\<notin>| frees (Sabs cs) |\<union>| consts (Sabs cs)
goal (1 subgoal):
1. False
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
False
goal (1 subgoal):
1. \<lbrakk>Name n |\<notin>| frees rhs; Name n |\<in>| consts rhs\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<lbrakk>Name n |\<notin>| frees rhs; Name n |\<in>| consts rhs\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
case B
[PROOF STATE]
proof (state)
this:
Name n |\<notin>| frees rhs
Name n |\<in>| consts rhs
goal (1 subgoal):
1. \<lbrakk>Name n |\<notin>| frees rhs; Name n |\<in>| consts rhs\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
hence "Name n |\<in>| consts (Sabs cs)"
[PROOF STATE]
proof (prove)
using this:
Name n |\<notin>| frees rhs
Name n |\<in>| consts rhs
goal (1 subgoal):
1. Name n |\<in>| consts (Sabs cs)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>Name n |\<notin>| frees rhs; Name n |\<in>| consts rhs\<rbrakk> \<Longrightarrow> Name n |\<in>| ffUnion ((\<lambda>(uu_, y). consts y) |`| fset_of_list cs)
[PROOF STEP]
unfolding ffUnion_alt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>Name n |\<notin>| frees rhs; Name n |\<in>| consts rhs\<rbrakk> \<Longrightarrow> fBex ((\<lambda>(uu_, y). consts y) |`| fset_of_list cs) ((|\<in>|) (Name n))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>Name n |\<notin>| frees rhs; Name n |\<in>| consts rhs\<rbrakk> \<Longrightarrow> fBex (fset_of_list cs) (\<lambda>x. Name n |\<in>| (case x of (uu_, x) \<Rightarrow> consts x))
[PROOF STEP]
apply (rule fBexI[where x = "(pat, rhs)"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<lbrakk>Name n |\<notin>| frees rhs; Name n |\<in>| consts rhs\<rbrakk> \<Longrightarrow> Name n |\<in>| (case (pat, rhs) of (uu_, x) \<Rightarrow> consts x)
2. \<lbrakk>Name n |\<notin>| frees rhs; Name n |\<in>| consts rhs\<rbrakk> \<Longrightarrow> (pat, rhs) |\<in>| fset_of_list cs
[PROOF STEP]
apply (auto simp: fset_of_list_elem)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>Name n |\<notin>| frees rhs; Name n |\<in>| consts rhs\<rbrakk> \<Longrightarrow> (pat, rhs) \<in> set cs
[PROOF STEP]
apply (rule \<open>(pat, rhs) \<in> set cs\<close>)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
Name n |\<in>| consts (Sabs cs)
goal (1 subgoal):
1. \<lbrakk>Name n |\<notin>| frees rhs; Name n |\<in>| consts rhs\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Name n |\<in>| consts (Sabs cs)
goal (1 subgoal):
1. False
[PROOF STEP]
using \<open>Name n |\<notin>| ids (Sabs cs)\<close>
[PROOF STATE]
proof (prove)
using this:
Name n |\<in>| consts (Sabs cs)
Name n |\<notin>| ids (Sabs cs)
goal (1 subgoal):
1. False
[PROOF STEP]
unfolding ids_def
[PROOF STATE]
proof (prove)
using this:
Name n |\<in>| consts (Sabs cs)
Name n |\<notin>| frees (Sabs cs) |\<union>| consts (Sabs cs)
goal (1 subgoal):
1. False
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
False
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
False
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Name n |\<notin>| fmdom env \<Longrightarrow> Name n |\<notin>| ids rhs
goal (11 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmrel_on_fset (ids rhs) erelated ?\<Gamma>'6 (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
5. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
6. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
7. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env) |\<union>| C
8. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
9. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
10. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
A total of 11 subgoals...
[PROOF STEP]
show "fmrel_on_fset (ids rhs) erelated (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env) (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmrel_on_fset (ids rhs) erelated (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env) (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<And>x. x |\<in>| ids rhs \<Longrightarrow> rel_option erelated (fmlookup (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env) x) (fmlookup (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env) x)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (4 subgoals):
1. \<lbrakk>Name n |\<in>| ids rhs; Name n |\<in>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup env (Name n)) (fmlookup env (Name n))
2. \<lbrakk>Name n |\<in>| ids rhs; Name n |\<notin>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup \<Gamma>\<^sub>\<Lambda> (Name n)) (Some v\<^sub>2)
3. \<And>x. \<lbrakk>x |\<in>| ids rhs; Name n \<noteq> x; x |\<in>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup env x) (fmlookup env x)
4. \<And>x. \<lbrakk>x |\<in>| ids rhs; Name n \<noteq> x; x |\<notin>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup \<Gamma>\<^sub>\<Lambda> x) (fmlookup \<Gamma>\<^sub>\<Lambda> x)
[PROOF STEP]
apply (rule option.rel_refl; rule erelated_refl)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. \<lbrakk>Name n |\<in>| ids rhs; Name n |\<notin>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup \<Gamma>\<^sub>\<Lambda> (Name n)) (Some v\<^sub>2)
2. \<And>x. \<lbrakk>x |\<in>| ids rhs; Name n \<noteq> x; x |\<in>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup env x) (fmlookup env x)
3. \<And>x. \<lbrakk>x |\<in>| ids rhs; Name n \<noteq> x; x |\<notin>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup \<Gamma>\<^sub>\<Lambda> x) (fmlookup \<Gamma>\<^sub>\<Lambda> x)
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
Name n |\<notin>| fmdom env \<Longrightarrow> Name n |\<notin>| ids rhs
goal (3 subgoals):
1. \<lbrakk>Name n |\<in>| ids rhs; Name n |\<notin>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup \<Gamma>\<^sub>\<Lambda> (Name n)) (Some v\<^sub>2)
2. \<And>x. \<lbrakk>x |\<in>| ids rhs; Name n \<noteq> x; x |\<in>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup env x) (fmlookup env x)
3. \<And>x. \<lbrakk>x |\<in>| ids rhs; Name n \<noteq> x; x |\<notin>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup \<Gamma>\<^sub>\<Lambda> x) (fmlookup \<Gamma>\<^sub>\<Lambda> x)
[PROOF STEP]
apply auto[]
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<And>x. \<lbrakk>x |\<in>| ids rhs; Name n \<noteq> x; x |\<in>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup env x) (fmlookup env x)
2. \<And>x. \<lbrakk>x |\<in>| ids rhs; Name n \<noteq> x; x |\<notin>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup \<Gamma>\<^sub>\<Lambda> x) (fmlookup \<Gamma>\<^sub>\<Lambda> x)
[PROOF STEP]
apply (rule option.rel_refl; rule erelated_refl)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
fmrel_on_fset (ids rhs) erelated (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env) (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
goal (10 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
5. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
6. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env) |\<union>| C
7. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
8. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
9. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
10. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (10 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
5. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
6. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env) |\<union>| C
7. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
8. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
9. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
10. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show "closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
2. closed_venv env
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. closed_venv env
[PROOF STEP]
apply (rule vclosed.vmatch_env)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. vmatch ?pat4 ?v4 = Some env
2. vclosed ?v4
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. vclosed v\<^sub>2
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
closed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
goal (9 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
5. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env) |\<union>| C
6. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
7. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
8. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
9. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (9 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
5. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env) |\<union>| C
6. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
7. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
8. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
9. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show "wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
2. wellformed_venv env
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. wellformed_venv env
[PROOF STEP]
apply (rule vwellformed.vmatch_env)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. vmatch ?pat4 ?v4 = Some env
2. vwellformed ?v4
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. vwellformed v\<^sub>2
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
wellformed_venv (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
goal (8 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env) |\<union>| C
5. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
6. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
7. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
8. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (8 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env) |\<union>| C
5. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
6. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
7. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
8. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show "closed_except rhs (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. closed_except rhs (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
[PROOF STEP]
using \<open>fmdom env = frees pat\<close> \<open>(pat, rhs) \<in> set cs\<close>
[PROOF STATE]
proof (prove)
using this:
fmdom env = frees pat
(pat, rhs) \<in> set cs
goal (1 subgoal):
1. closed_except rhs (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
[PROOF STEP]
using \<open>closed_except (Sabs cs) (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))\<close>
[PROOF STATE]
proof (prove)
using this:
fmdom env = frees pat
(pat, rhs) \<in> set cs
closed_except (Sabs cs) (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
goal (1 subgoal):
1. closed_except rhs (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
[PROOF STEP]
by (auto simp: Sterm.closed_except_simps list_all_iff)
[PROOF STATE]
proof (state)
this:
closed_except rhs (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
goal (7 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env) |\<union>| C
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
5. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
6. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
7. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (7 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env) |\<union>| C
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
5. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
6. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
7. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show "wellformed rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. pre_strong_term_class.wellformed rhs
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
pre_strong_term_class.wellformed rhs
goal (6 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env) |\<union>| C
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
5. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
6. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (6 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env) |\<union>| C
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
5. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
6. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show "consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env) |\<union>| C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env) |\<union>| C
[PROOF STEP]
using \<open>consts (Sabs cs) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| C\<close> \<open>(pat, rhs) \<in> set cs\<close>
[PROOF STATE]
proof (prove)
using this:
consts (Sabs cs) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| C
(pat, rhs) \<in> set cs
goal (1 subgoal):
1. consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env) |\<union>| C
[PROOF STEP]
unfolding sconsts_sabs
[PROOF STATE]
proof (prove)
using this:
list_all (\<lambda>(uu_, t). consts t |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| C) cs
(pat, rhs) \<in> set cs
goal (1 subgoal):
1. consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env) |\<union>| C
[PROOF STEP]
by (auto simp: list_all_iff)
[PROOF STATE]
proof (state)
this:
consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env) |\<union>| C
goal (5 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
5. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (5 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
5. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have "fdisjnt C (fmdom env)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fdisjnt C (fmdom env)
[PROOF STEP]
using \<open>(pat, rhs) \<in> set cs\<close> \<open>\<not> shadows_consts (Sabs cs)\<close>
[PROOF STATE]
proof (prove)
using this:
(pat, rhs) \<in> set cs
\<not> shadows_consts (Sabs cs)
goal (1 subgoal):
1. fdisjnt C (fmdom env)
[PROOF STEP]
unfolding \<open>fmdom env = frees pat\<close>
[PROOF STATE]
proof (prove)
using this:
(pat, rhs) \<in> set cs
\<not> shadows_consts (Sabs cs)
goal (1 subgoal):
1. fdisjnt C (frees pat)
[PROOF STEP]
by (auto simp: list_ex_iff fdisjnt_alt_def all_consts_def)
[PROOF STATE]
proof (state)
this:
fdisjnt C (fmdom env)
goal (5 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
5. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
thus "fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))"
[PROOF STATE]
proof (prove)
using this:
fdisjnt C (fmdom env)
goal (1 subgoal):
1. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
[PROOF STEP]
using \<open>Name n |\<notin>| all_consts\<close> \<open>fdisjnt C (fmdom \<Gamma>\<^sub>\<Lambda>)\<close>
[PROOF STATE]
proof (prove)
using this:
fdisjnt C (fmdom env)
Name n |\<notin>| all_consts
fdisjnt C (fmdom \<Gamma>\<^sub>\<Lambda>)
goal (1 subgoal):
1. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
[PROOF STEP]
unfolding fdisjnt_alt_def
[PROOF STATE]
proof (prove)
using this:
C |\<inter>| fmdom env = {||}
Name n |\<notin>| all_consts
C |\<inter>| fmdom \<Gamma>\<^sub>\<Lambda> = {||}
goal (1 subgoal):
1. C |\<inter>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env) = {||}
[PROOF STEP]
by (auto simp: all_consts_def)
[PROOF STATE]
proof (state)
this:
fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env))
goal (4 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
4. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (4 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
4. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show "\<not> shadows_consts rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<not> shadows_consts rhs
[PROOF STEP]
using \<open>(pat, rhs) \<in> set cs\<close> \<open>\<not> shadows_consts (Sabs cs)\<close>
[PROOF STATE]
proof (prove)
using this:
(pat, rhs) \<in> set cs
\<not> shadows_consts (Sabs cs)
goal (1 subgoal):
1. \<not> shadows_consts rhs
[PROOF STEP]
by (auto simp: list_ex_iff)
[PROOF STATE]
proof (state)
this:
\<not> shadows_consts rhs
goal (3 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
3. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
3. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have "not_shadows_vconsts_env env"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. not_shadows_vconsts_env env
[PROOF STEP]
by (rule not_shadows_vconsts.vmatch_env) fact+
[PROOF STATE]
proof (state)
this:
not_shadows_vconsts_env env
goal (3 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
3. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
thus "not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)"
[PROOF STATE]
proof (prove)
using this:
not_shadows_vconsts_env env
goal (1 subgoal):
1. not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
[PROOF STEP]
using \<open>not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)\<close>
[PROOF STATE]
proof (prove)
using this:
not_shadows_vconsts_env env
not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
goal (1 subgoal):
1. not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
goal (2 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
2. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
2. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have "fmpred (\<lambda>_. vwelldefined') env"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmpred (\<lambda>_. vwelldefined') env
[PROOF STEP]
by (rule vmatch_welldefined') fact+
[PROOF STATE]
proof (state)
this:
fmpred (\<lambda>_. vwelldefined') env
goal (2 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
2. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
thus "fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)"
[PROOF STATE]
proof (prove)
using this:
fmpred (\<lambda>_. vwelldefined') env
goal (1 subgoal):
1. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
[PROOF STEP]
using \<open>fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)\<close>
[PROOF STATE]
proof (prove)
using this:
fmpred (\<lambda>_. vwelldefined') env
fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>)
goal (1 subgoal):
1. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env)
goal (1 subgoal):
1. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
qed blast
[PROOF STATE]
proof (state)
this:
\<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'
v' \<approx>\<^sub>e v
goal (2 subgoals):
1. \<And>env n v0. \<lbrakk>rev ml_vs = [Closure env n exp', v0]; env' = update_v (\<lambda>_. nsBind n v0 (sem_env.v env)) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
2. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
apply (intro exI conjI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<Gamma> \<turnstile>\<^sub>v t \<down> ?v
2. related_v ?v ml_v
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<Gamma> \<turnstile>\<^sub>v t\<^sub>1 $\<^sub>s t\<^sub>2 \<down> ?v
2. related_v ?v ml_v
[PROOF STEP]
apply (rule veval'.comb)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
1. \<Gamma> \<turnstile>\<^sub>v t\<^sub>1 \<down> Vabs ?cs2 ?\<Gamma>'2
2. \<Gamma> \<turnstile>\<^sub>v t\<^sub>2 \<down> ?u'2
3. vfind_match ?cs2 ?u'2 = Some (?env2, ?uu2, ?rhs2)
4. ?\<Gamma>'2 ++\<^sub>f ?env2 \<turnstile>\<^sub>v ?rhs2 \<down> ?v
5. related_v ?v ml_v
[PROOF STEP]
using \<open>\<Gamma> \<turnstile>\<^sub>v t\<^sub>1 \<down> v\<^sub>1\<close>
[PROOF STATE]
proof (prove)
using this:
\<Gamma> \<turnstile>\<^sub>v t\<^sub>1 \<down> v\<^sub>1
goal (5 subgoals):
1. \<Gamma> \<turnstile>\<^sub>v t\<^sub>1 \<down> Vabs ?cs2 ?\<Gamma>'2
2. \<Gamma> \<turnstile>\<^sub>v t\<^sub>2 \<down> ?u'2
3. vfind_match ?cs2 ?u'2 = Some (?env2, ?uu2, ?rhs2)
4. ?\<Gamma>'2 ++\<^sub>f ?env2 \<turnstile>\<^sub>v ?rhs2 \<down> ?v
5. related_v ?v ml_v
[PROOF STEP]
unfolding \<open>v\<^sub>1 = _\<close>
[PROOF STATE]
proof (prove)
using this:
\<Gamma> \<turnstile>\<^sub>v t\<^sub>1 \<down> Vabs cs \<Gamma>\<^sub>\<Lambda>
goal (5 subgoals):
1. \<Gamma> \<turnstile>\<^sub>v t\<^sub>1 \<down> Vabs ?cs2 ?\<Gamma>'2
2. \<Gamma> \<turnstile>\<^sub>v t\<^sub>2 \<down> ?u'2
3. vfind_match ?cs2 ?u'2 = Some (?env2, ?uu2, ?rhs2)
4. ?\<Gamma>'2 ++\<^sub>f ?env2 \<turnstile>\<^sub>v ?rhs2 \<down> ?v
5. related_v ?v ml_v
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (4 subgoals):
1. \<Gamma> \<turnstile>\<^sub>v t\<^sub>2 \<down> ?u'2
2. vfind_match cs ?u'2 = Some (?env2, ?uu2, ?rhs2)
3. \<Gamma>\<^sub>\<Lambda> ++\<^sub>f ?env2 \<turnstile>\<^sub>v ?rhs2 \<down> ?v
4. related_v ?v ml_v
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. vfind_match cs v\<^sub>2 = Some (?env2, ?uu2, ?rhs2)
2. \<Gamma>\<^sub>\<Lambda> ++\<^sub>f ?env2 \<turnstile>\<^sub>v ?rhs2 \<down> ?v
3. related_v ?v ml_v
[PROOF STEP]
apply fact+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. related_v v' ml_v
[PROOF STEP]
apply (rule related_v_ext)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. related_v ?v13 ml_v
2. v' \<approx>\<^sub>e ?v13
[PROOF STEP]
apply fact+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
\<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
goal (1 subgoal):
1. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
case (recclosure env\<^sub>\<Lambda> funs name n)
[PROOF STATE]
proof (state)
this:
rev ml_vs = [Recclosure env\<^sub>\<Lambda> funs name, v0_]
allDistinct (map (\<lambda>(f, uu_, uu_). f) funs)
find_recfun name funs = Some (n, exp')
env' = update_v (\<lambda>_. nsBind n v0_ (build_rec_env funs env\<^sub>\<Lambda> (sem_env.v env\<^sub>\<Lambda>))) env\<^sub>\<Lambda>
goal (1 subgoal):
1. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
with recclosure
[PROOF STATE]
proof (chain)
picking this:
rev ml_vs = [Recclosure env\<^sub>\<Lambda> funs name, v0_]
allDistinct (map (\<lambda>(f, uu_, uu_). f) funs)
find_recfun name funs = Some (n, exp')
env' = update_v (\<lambda>_. nsBind n v0_ (build_rec_env funs env\<^sub>\<Lambda> (sem_env.v env\<^sub>\<Lambda>))) env\<^sub>\<Lambda>
rev ml_vs = [Recclosure env\<^sub>\<Lambda> funs name, v0_]
allDistinct (map (\<lambda>(f, uu_, uu_). f) funs)
find_recfun name funs = Some (n, exp')
env' = update_v (\<lambda>_. nsBind n v0_ (build_rec_env funs env\<^sub>\<Lambda> (sem_env.v env\<^sub>\<Lambda>))) env\<^sub>\<Lambda>
[PROOF STEP]
have recclosure':
"ml_v\<^sub>1 = Recclosure env\<^sub>\<Lambda> funs name"
"env' = update_v (\<lambda>_. nsBind (as_string (Name n)) ml_v\<^sub>2 (build_rec_env funs env\<^sub>\<Lambda> (sem_env.v env\<^sub>\<Lambda>))) env\<^sub>\<Lambda>"
[PROOF STATE]
proof (prove)
using this:
rev ml_vs = [Recclosure env\<^sub>\<Lambda> funs name, v0_]
allDistinct (map (\<lambda>(f, uu_, uu_). f) funs)
find_recfun name funs = Some (n, exp')
env' = update_v (\<lambda>_. nsBind n v0_ (build_rec_env funs env\<^sub>\<Lambda> (sem_env.v env\<^sub>\<Lambda>))) env\<^sub>\<Lambda>
rev ml_vs = [Recclosure env\<^sub>\<Lambda> funs name, v0_]
allDistinct (map (\<lambda>(f, uu_, uu_). f) funs)
find_recfun name funs = Some (n, exp')
env' = update_v (\<lambda>_. nsBind n v0_ (build_rec_env funs env\<^sub>\<Lambda> (sem_env.v env\<^sub>\<Lambda>))) env\<^sub>\<Lambda>
goal (1 subgoal):
1. ml_v\<^sub>1 = Recclosure env\<^sub>\<Lambda> funs name &&& env' = update_v (\<lambda>_. nsBind (as_string (Name n)) ml_v\<^sub>2 (build_rec_env funs env\<^sub>\<Lambda> (sem_env.v env\<^sub>\<Lambda>))) env\<^sub>\<Lambda>
[PROOF STEP]
unfolding \<open>ml_vs = _\<close>
[PROOF STATE]
proof (prove)
using this:
rev [ml_v\<^sub>2, ml_v\<^sub>1] = [Recclosure env\<^sub>\<Lambda> funs name, v0_]
allDistinct (map (\<lambda>(f, uu_, uu_). f) funs)
find_recfun name funs = Some (n, exp')
env' = update_v (\<lambda>_. nsBind n v0_ (build_rec_env funs env\<^sub>\<Lambda> (sem_env.v env\<^sub>\<Lambda>))) env\<^sub>\<Lambda>
rev [ml_v\<^sub>2, ml_v\<^sub>1] = [Recclosure env\<^sub>\<Lambda> funs name, v0_]
allDistinct (map (\<lambda>(f, uu_, uu_). f) funs)
find_recfun name funs = Some (n, exp')
env' = update_v (\<lambda>_. nsBind n v0_ (build_rec_env funs env\<^sub>\<Lambda> (sem_env.v env\<^sub>\<Lambda>))) env\<^sub>\<Lambda>
goal (1 subgoal):
1. ml_v\<^sub>1 = Recclosure env\<^sub>\<Lambda> funs name &&& env' = update_v (\<lambda>_. nsBind (as_string (Name n)) ml_v\<^sub>2 (build_rec_env funs env\<^sub>\<Lambda> (sem_env.v env\<^sub>\<Lambda>))) env\<^sub>\<Lambda>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ml_v\<^sub>1 = Recclosure env\<^sub>\<Lambda> funs name
env' = update_v (\<lambda>_. nsBind (as_string (Name n)) ml_v\<^sub>2 (build_rec_env funs env\<^sub>\<Lambda> (sem_env.v env\<^sub>\<Lambda>))) env\<^sub>\<Lambda>
goal (1 subgoal):
1. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
obtain \<Gamma>\<^sub>\<Lambda> css
where "v\<^sub>1 = Vrecabs css (Name name) \<Gamma>\<^sub>\<Lambda>"
and "fmrel_on_fset (fbind (fmran css) (ids \<circ> Sabs)) related_v \<Gamma>\<^sub>\<Lambda> (fmap_of_ns (sem_env.v env\<^sub>\<Lambda>))"
and "fmrel (\<lambda>cs (n, e). related_fun cs n e) css (fmap_of_list (map (map_prod Name (map_prod Name id)) funs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<And>css \<Gamma>\<^sub>\<Lambda>. \<lbrakk>v\<^sub>1 = Vrecabs css (Name name) \<Gamma>\<^sub>\<Lambda>; fmrel_on_fset (fbind (fmran css) (ids \<circ> Sabs)) related_v \<Gamma>\<^sub>\<Lambda> (fmap_of_ns (sem_env.v env\<^sub>\<Lambda>)); fmrel (\<lambda>cs (n, e). related_fun cs n e) css (fmap_of_list (map (map_prod Name (map_prod Name id)) funs))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>related_v v\<^sub>1 ml_v\<^sub>1\<close>
[PROOF STATE]
proof (prove)
using this:
related_v v\<^sub>1 ml_v\<^sub>1
goal (1 subgoal):
1. (\<And>css \<Gamma>\<^sub>\<Lambda>. \<lbrakk>v\<^sub>1 = Vrecabs css (Name name) \<Gamma>\<^sub>\<Lambda>; fmrel_on_fset (fbind (fmran css) (ids \<circ> Sabs)) related_v \<Gamma>\<^sub>\<Lambda> (fmap_of_ns (sem_env.v env\<^sub>\<Lambda>)); fmrel (\<lambda>cs (n, e). related_fun cs n e) css (fmap_of_list (map (map_prod Name (map_prod Name id)) funs))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding \<open>ml_v\<^sub>1 = _\<close>
[PROOF STATE]
proof (prove)
using this:
related_v v\<^sub>1 (Recclosure env\<^sub>\<Lambda> funs name)
goal (1 subgoal):
1. (\<And>css \<Gamma>\<^sub>\<Lambda>. \<lbrakk>v\<^sub>1 = Vrecabs css (Name name) \<Gamma>\<^sub>\<Lambda>; fmrel_on_fset (fbind (fmran css) (ids \<circ> Sabs)) related_v \<Gamma>\<^sub>\<Lambda> (fmap_of_ns (sem_env.v env\<^sub>\<Lambda>)); fmrel (\<lambda>cs (n, e). related_fun cs n e) css (fmap_of_list (map (map_prod Name (map_prod Name id)) funs))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by cases auto
[PROOF STATE]
proof (state)
this:
v\<^sub>1 = Vrecabs css (Name name) \<Gamma>\<^sub>\<Lambda>
fmrel_on_fset (fbind (fmran css) (ids \<circ> Sabs)) related_v \<Gamma>\<^sub>\<Lambda> (fmap_of_ns (sem_env.v env\<^sub>\<Lambda>))
fmrel (\<lambda>cs (n, e). related_fun cs n e) css (fmap_of_list (map (map_prod Name (map_prod Name id)) funs))
goal (1 subgoal):
1. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
from \<open>fmrel _ _ _\<close>
[PROOF STATE]
proof (chain)
picking this:
fmrel (\<lambda>cs (n, e). related_fun cs n e) css (fmap_of_list (map (map_prod Name (map_prod Name id)) funs))
[PROOF STEP]
have "rel_option (\<lambda>cs (n, e). related_fun cs (Name n) e) (fmlookup css (Name name)) (find_recfun name funs)"
[PROOF STATE]
proof (prove)
using this:
fmrel (\<lambda>cs (n, e). related_fun cs n e) css (fmap_of_list (map (map_prod Name (map_prod Name id)) funs))
goal (1 subgoal):
1. rel_option (\<lambda>cs (n, e). related_fun cs (Name n) e) (fmlookup css (Name name)) (find_recfun name funs)
[PROOF STEP]
apply -
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmrel (\<lambda>cs (n, e). related_fun cs n e) css (fmap_of_list (map (map_prod Name (map_prod Name id)) funs)) \<Longrightarrow> rel_option (\<lambda>cs (n, e). related_fun cs (Name n) e) (fmlookup css (Name name)) (find_recfun name funs)
[PROOF STEP]
apply (subst option.rel_sel)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmrel (\<lambda>cs (n, e). related_fun cs n e) css (fmap_of_list (map (map_prod Name (map_prod Name id)) funs)) \<Longrightarrow> (fmlookup css (Name name) = None) = (find_recfun name funs = None) \<and> (fmlookup css (Name name) \<noteq> None \<longrightarrow> find_recfun name funs \<noteq> None \<longrightarrow> (case option.the (find_recfun name funs) of (n, x) \<Rightarrow> related_fun (option.the (fmlookup css (Name name))) (Name n) x))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. \<lbrakk>fmrel (\<lambda>cs (n, e). related_fun cs n e) css (fmap_of_list (map (map_prod Name (map_prod Name id)) funs)); fmlookup css (Name name) = None\<rbrakk> \<Longrightarrow> map_of funs name = None
2. \<lbrakk>fmrel (\<lambda>cs (n, e). related_fun cs n e) css (fmap_of_list (map (map_prod Name (map_prod Name id)) funs)); map_of funs name = None\<rbrakk> \<Longrightarrow> fmlookup css (Name name) = None
3. \<And>y n b. \<lbrakk>fmrel (\<lambda>cs (x, y). related_fun cs x y) css (fmap_of_list (map (map_prod Name (map_prod Name id)) funs)); fmlookup css (Name name) = Some y; map_of funs name = Some (n, b)\<rbrakk> \<Longrightarrow> related_fun y (Name n) b
[PROOF STEP]
apply (drule fmrel_fmdom_eq)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. \<lbrakk>fmlookup css (Name name) = None; fmdom css = fmdom (fmap_of_list (map (map_prod Name (map_prod Name id)) funs))\<rbrakk> \<Longrightarrow> map_of funs name = None
2. \<lbrakk>fmrel (\<lambda>cs (n, e). related_fun cs n e) css (fmap_of_list (map (map_prod Name (map_prod Name id)) funs)); map_of funs name = None\<rbrakk> \<Longrightarrow> fmlookup css (Name name) = None
3. \<And>y n b. \<lbrakk>fmrel (\<lambda>cs (x, y). related_fun cs x y) css (fmap_of_list (map (map_prod Name (map_prod Name id)) funs)); fmlookup css (Name name) = Some y; map_of funs name = Some (n, b)\<rbrakk> \<Longrightarrow> related_fun y (Name n) b
[PROOF STEP]
apply (drule fmdom_notI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. \<lbrakk>fmdom css = fmdom (fmap_of_list (map (map_prod Name (map_prod Name id)) funs)); Name name |\<notin>| fmdom css\<rbrakk> \<Longrightarrow> map_of funs name = None
2. \<lbrakk>fmrel (\<lambda>cs (n, e). related_fun cs n e) css (fmap_of_list (map (map_prod Name (map_prod Name id)) funs)); map_of funs name = None\<rbrakk> \<Longrightarrow> fmlookup css (Name name) = None
3. \<And>y n b. \<lbrakk>fmrel (\<lambda>cs (x, y). related_fun cs x y) css (fmap_of_list (map (map_prod Name (map_prod Name id)) funs)); fmlookup css (Name name) = Some y; map_of funs name = Some (n, b)\<rbrakk> \<Longrightarrow> related_fun y (Name n) b
[PROOF STEP]
using \<open>v\<^sub>1 = Vrecabs css (Name name) \<Gamma>\<^sub>\<Lambda>\<close> \<open>vwellformed v\<^sub>1\<close>
[PROOF STATE]
proof (prove)
using this:
v\<^sub>1 = Vrecabs css (Name name) \<Gamma>\<^sub>\<Lambda>
vwellformed v\<^sub>1
goal (3 subgoals):
1. \<lbrakk>fmdom css = fmdom (fmap_of_list (map (map_prod Name (map_prod Name id)) funs)); Name name |\<notin>| fmdom css\<rbrakk> \<Longrightarrow> map_of funs name = None
2. \<lbrakk>fmrel (\<lambda>cs (n, e). related_fun cs n e) css (fmap_of_list (map (map_prod Name (map_prod Name id)) funs)); map_of funs name = None\<rbrakk> \<Longrightarrow> fmlookup css (Name name) = None
3. \<And>y n b. \<lbrakk>fmrel (\<lambda>cs (x, y). related_fun cs x y) css (fmap_of_list (map (map_prod Name (map_prod Name id)) funs)); fmlookup css (Name name) = Some y; map_of funs name = Some (n, b)\<rbrakk> \<Longrightarrow> related_fun y (Name n) b
[PROOF STEP]
apply auto[1]
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<lbrakk>fmrel (\<lambda>cs (n, e). related_fun cs n e) css (fmap_of_list (map (map_prod Name (map_prod Name id)) funs)); map_of funs name = None\<rbrakk> \<Longrightarrow> fmlookup css (Name name) = None
2. \<And>y n b. \<lbrakk>fmrel (\<lambda>cs (x, y). related_fun cs x y) css (fmap_of_list (map (map_prod Name (map_prod Name id)) funs)); fmlookup css (Name name) = Some y; map_of funs name = Some (n, b)\<rbrakk> \<Longrightarrow> related_fun y (Name n) b
[PROOF STEP]
using recclosure(3)
[PROOF STATE]
proof (prove)
using this:
find_recfun name funs = Some (n, exp')
goal (2 subgoals):
1. \<lbrakk>fmrel (\<lambda>cs (n, e). related_fun cs n e) css (fmap_of_list (map (map_prod Name (map_prod Name id)) funs)); map_of funs name = None\<rbrakk> \<Longrightarrow> fmlookup css (Name name) = None
2. \<And>y n b. \<lbrakk>fmrel (\<lambda>cs (x, y). related_fun cs x y) css (fmap_of_list (map (map_prod Name (map_prod Name id)) funs)); fmlookup css (Name name) = Some y; map_of funs name = Some (n, b)\<rbrakk> \<Longrightarrow> related_fun y (Name n) b
[PROOF STEP]
apply auto[1]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<And>y n b. \<lbrakk>fmrel (\<lambda>cs (x, y). related_fun cs x y) css (fmap_of_list (map (map_prod Name (map_prod Name id)) funs)); fmlookup css (Name name) = Some y; map_of funs name = Some (n, b)\<rbrakk> \<Longrightarrow> related_fun y (Name n) b
[PROOF STEP]
apply (erule fmrel_cases[where x = "Name name"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<And>y n b. \<lbrakk>fmlookup css (Name name) = Some y; map_of funs name = Some (n, b); fmlookup css (Name name) = None; fmlookup (fmap_of_list (map (map_prod Name (map_prod Name id)) funs)) (Name name) = None\<rbrakk> \<Longrightarrow> related_fun y (Name n) b
2. \<And>y n b a ba. \<lbrakk>fmlookup css (Name name) = Some y; map_of funs name = Some (n, b); fmlookup css (Name name) = Some a; fmlookup (fmap_of_list (map (map_prod Name (map_prod Name id)) funs)) (Name name) = Some ba; case ba of (x, xa) \<Rightarrow> related_fun a x xa\<rbrakk> \<Longrightarrow> related_fun y (Name n) b
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<And>y n b a ba. \<lbrakk>fmlookup css (Name name) = Some y; map_of funs name = Some (n, b); fmlookup css (Name name) = Some a; fmlookup (fmap_of_list (map (map_prod Name (map_prod Name id)) funs)) (Name name) = Some ba; case ba of (x, xa) \<Rightarrow> related_fun a x xa\<rbrakk> \<Longrightarrow> related_fun y (Name n) b
[PROOF STEP]
apply (subst (asm) fmlookup_of_list)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<And>y n b a ba. \<lbrakk>fmlookup css (Name name) = Some y; map_of funs name = Some (n, b); fmlookup css (Name name) = Some a; map_of (map (map_prod Name (map_prod Name id)) funs) (Name name) = Some ba; case ba of (x, xa) \<Rightarrow> related_fun a x xa\<rbrakk> \<Longrightarrow> related_fun y (Name n) b
[PROOF STEP]
apply (simp add: name.map_of_rekey')
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<And>y n b a ba. \<lbrakk>a = y; map_of funs name = Some (n, b); fmlookup css (Name name) = Some y; (Name n, b) = ba; case ba of (x, xa) \<Rightarrow> related_fun y x xa\<rbrakk> \<Longrightarrow> related_fun y (Name n) b
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
rel_option (\<lambda>cs (n, e). related_fun cs (Name n) e) (fmlookup css (Name name)) (find_recfun name funs)
goal (1 subgoal):
1. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
rel_option (\<lambda>cs (n, e). related_fun cs (Name n) e) (fmlookup css (Name name)) (find_recfun name funs)
[PROOF STEP]
obtain cs where "fmlookup css (Name name) = Some cs" "related_fun cs (Name n) exp'"
[PROOF STATE]
proof (prove)
using this:
rel_option (\<lambda>cs (n, e). related_fun cs (Name n) e) (fmlookup css (Name name)) (find_recfun name funs)
goal (1 subgoal):
1. (\<And>cs. \<lbrakk>fmlookup css (Name name) = Some cs; related_fun cs (Name n) exp'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>find_recfun _ _ = _\<close>
[PROOF STATE]
proof (prove)
using this:
rel_option (\<lambda>cs (n, e). related_fun cs (Name n) e) (fmlookup css (Name name)) (find_recfun name funs)
find_recfun name funs = Some (n, exp')
goal (1 subgoal):
1. (\<And>cs. \<lbrakk>fmlookup css (Name name) = Some cs; related_fun cs (Name n) exp'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by cases auto
[PROOF STATE]
proof (state)
this:
fmlookup css (Name name) = Some cs
related_fun cs (Name n) exp'
goal (1 subgoal):
1. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
fmlookup css (Name name) = Some cs
related_fun cs (Name n) exp'
[PROOF STEP]
obtain ml_cs
where "exp' = Mat (Var (Short (as_string (Name n)))) ml_cs" "Name n |\<notin>| ids (Sabs cs)" "Name n |\<notin>| all_consts"
and "list_all2 (rel_prod related_pat related_exp) cs ml_cs"
[PROOF STATE]
proof (prove)
using this:
fmlookup css (Name name) = Some cs
related_fun cs (Name n) exp'
goal (1 subgoal):
1. (\<And>ml_cs. \<lbrakk>exp' = Mat (Var (Short (as_string (Name n)))) ml_cs; Name n |\<notin>| ids (Sabs cs); Name n |\<notin>| all_consts; list_all2 (rel_prod related_pat related_exp) cs ml_cs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto elim: related_funE)
[PROOF STATE]
proof (state)
this:
exp' = Mat (Var (Short (as_string (Name n)))) ml_cs
Name n |\<notin>| ids (Sabs cs)
Name n |\<notin>| all_consts
list_all2 (rel_prod related_pat related_exp) cs ml_cs
goal (1 subgoal):
1. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
hence "cupcake_evaluate_single env' (Mat (Var (Short n)) ml_cs) (Rval ml_v)"
[PROOF STATE]
proof (prove)
using this:
exp' = Mat (Var (Short (as_string (Name n)))) ml_cs
Name n |\<notin>| ids (Sabs cs)
Name n |\<notin>| all_consts
list_all2 (rel_prod related_pat related_exp) cs ml_cs
goal (1 subgoal):
1. cupcake_evaluate_single env' (Mat (Var (Short n)) ml_cs) (Rval ml_v)
[PROOF STEP]
using \<open>cupcake_evaluate_single env' exp' bv\<close>
[PROOF STATE]
proof (prove)
using this:
exp' = Mat (Var (Short (as_string (Name n)))) ml_cs
Name n |\<notin>| ids (Sabs cs)
Name n |\<notin>| all_consts
list_all2 (rel_prod related_pat related_exp) cs ml_cs
cupcake_evaluate_single env' exp' bv
goal (1 subgoal):
1. cupcake_evaluate_single env' (Mat (Var (Short n)) ml_cs) (Rval ml_v)
[PROOF STEP]
unfolding \<open>bv = _\<close>
[PROOF STATE]
proof (prove)
using this:
exp' = Mat (Var (Short (as_string (Name n)))) ml_cs
Name n |\<notin>| ids (Sabs cs)
Name n |\<notin>| all_consts
list_all2 (rel_prod related_pat related_exp) cs ml_cs
cupcake_evaluate_single env' exp' (Rval ml_v)
goal (1 subgoal):
1. cupcake_evaluate_single env' (Mat (Var (Short n)) ml_cs) (Rval ml_v)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cupcake_evaluate_single env' (Mat (Var (Short n)) ml_cs) (Rval ml_v)
goal (1 subgoal):
1. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cupcake_evaluate_single env' (Mat (Var (Short n)) ml_cs) (Rval ml_v)
[PROOF STEP]
obtain m_env v' ml_rhs ml_pat
where "cupcake_evaluate_single env' (Var (Short n)) (Rval v')"
and "cupcake_match_result (sem_env.c env') v' ml_cs Bindv = Rval (ml_rhs, ml_pat, m_env)"
and "cupcake_evaluate_single (env' \<lparr> sem_env.v := nsAppend (alist_to_ns m_env) (sem_env.v env') \<rparr>) ml_rhs (Rval ml_v)"
[PROOF STATE]
proof (prove)
using this:
cupcake_evaluate_single env' (Mat (Var (Short n)) ml_cs) (Rval ml_v)
goal (1 subgoal):
1. (\<And>v' ml_rhs ml_pat m_env. \<lbrakk>cupcake_evaluate_single env' (Var (Short n)) (Rval v'); cupcake_match_result (sem_env.c env') v' ml_cs Bindv = Rval (ml_rhs, ml_pat, m_env); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns m_env) (sem_env.v env')) env') ml_rhs (Rval ml_v)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by cases auto
[PROOF STATE]
proof (state)
this:
cupcake_evaluate_single env' (Var (Short n)) (Rval v')
cupcake_match_result (sem_env.c env') v' ml_cs Bindv = Rval (ml_rhs, ml_pat, m_env)
cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns m_env) (sem_env.v env')) env') ml_rhs (Rval ml_v)
goal (1 subgoal):
1. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
have "closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
using \<open>vclosed v\<^sub>1\<close> \<open>vclosed v\<^sub>2\<close>
[PROOF STATE]
proof (prove)
using this:
vclosed v\<^sub>1
vclosed v\<^sub>2
goal (1 subgoal):
1. closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
using \<open>fmlookup css (Name name) = Some cs\<close>
[PROOF STATE]
proof (prove)
using this:
vclosed v\<^sub>1
vclosed v\<^sub>2
fmlookup css (Name name) = Some cs
goal (1 subgoal):
1. closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
unfolding \<open>v\<^sub>1 = _\<close> mk_rec_env_def
[PROOF STATE]
proof (prove)
using this:
vclosed (Vrecabs css (Name name) \<Gamma>\<^sub>\<Lambda>)
vclosed v\<^sub>2
fmlookup css (Name name) = Some cs
goal (1 subgoal):
1. closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f fmmap_keys (\<lambda>name cs. Vrecabs css name \<Gamma>\<^sub>\<Lambda>) css))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>vclosed v\<^sub>2; fmlookup css (Name name) = Some cs; closed_venv \<Gamma>\<^sub>\<Lambda>; fmpred (\<lambda>_. list_all (\<lambda>(pat, t). closed_except t (fmdom \<Gamma>\<^sub>\<Lambda> |\<union>| frees pat))) css; Name name |\<in>| fmdom css\<rbrakk> \<Longrightarrow> closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f fmmap_keys (\<lambda>name cs. Vrecabs css name \<Gamma>\<^sub>\<Lambda>) css))
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<lbrakk>vclosed v\<^sub>2; fmlookup css (Name name) = Some cs; closed_venv \<Gamma>\<^sub>\<Lambda>; fmpred (\<lambda>_. list_all (\<lambda>(pat, t). closed_except t (fmdom \<Gamma>\<^sub>\<Lambda> |\<union>| frees pat))) css; Name name |\<in>| fmdom css\<rbrakk> \<Longrightarrow> closed_venv (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f fmmap_keys (\<lambda>name cs. Vrecabs css name \<Gamma>\<^sub>\<Lambda>) css)
2. \<lbrakk>vclosed v\<^sub>2; fmlookup css (Name name) = Some cs; closed_venv \<Gamma>\<^sub>\<Lambda>; fmpred (\<lambda>_. list_all (\<lambda>(pat, t). closed_except t (fmdom \<Gamma>\<^sub>\<Lambda> |\<union>| frees pat))) css; Name name |\<in>| fmdom css\<rbrakk> \<Longrightarrow> vclosed v\<^sub>2
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. \<lbrakk>vclosed v\<^sub>2; fmlookup css (Name name) = Some cs; closed_venv \<Gamma>\<^sub>\<Lambda>; fmpred (\<lambda>_. list_all (\<lambda>(pat, t). closed_except t (fmdom \<Gamma>\<^sub>\<Lambda> |\<union>| frees pat))) css; Name name |\<in>| fmdom css\<rbrakk> \<Longrightarrow> closed_venv \<Gamma>\<^sub>\<Lambda>
2. \<lbrakk>vclosed v\<^sub>2; fmlookup css (Name name) = Some cs; closed_venv \<Gamma>\<^sub>\<Lambda>; fmpred (\<lambda>_. list_all (\<lambda>(pat, t). closed_except t (fmdom \<Gamma>\<^sub>\<Lambda> |\<union>| frees pat))) css; Name name |\<in>| fmdom css\<rbrakk> \<Longrightarrow> closed_venv (fmmap_keys (\<lambda>name cs. Vrecabs css name \<Gamma>\<^sub>\<Lambda>) css)
3. \<lbrakk>vclosed v\<^sub>2; fmlookup css (Name name) = Some cs; closed_venv \<Gamma>\<^sub>\<Lambda>; fmpred (\<lambda>_. list_all (\<lambda>(pat, t). closed_except t (fmdom \<Gamma>\<^sub>\<Lambda> |\<union>| frees pat))) css; Name name |\<in>| fmdom css\<rbrakk> \<Longrightarrow> vclosed v\<^sub>2
[PROOF STEP]
apply (auto intro: fmdomI)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
goal (1 subgoal):
1. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
have "wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
using \<open>vwellformed v\<^sub>1\<close> \<open>vwellformed v\<^sub>2\<close>
[PROOF STATE]
proof (prove)
using this:
vwellformed v\<^sub>1
vwellformed v\<^sub>2
goal (1 subgoal):
1. wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
using \<open>fmlookup css (Name name) = Some cs\<close>
[PROOF STATE]
proof (prove)
using this:
vwellformed v\<^sub>1
vwellformed v\<^sub>2
fmlookup css (Name name) = Some cs
goal (1 subgoal):
1. wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
unfolding \<open>v\<^sub>1 = _\<close> mk_rec_env_def
[PROOF STATE]
proof (prove)
using this:
vwellformed (Vrecabs css (Name name) \<Gamma>\<^sub>\<Lambda>)
vwellformed v\<^sub>2
fmlookup css (Name name) = Some cs
goal (1 subgoal):
1. wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f fmmap_keys (\<lambda>name cs. Vrecabs css name \<Gamma>\<^sub>\<Lambda>) css))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>vwellformed v\<^sub>2; fmlookup css (Name name) = Some cs; wellformed_venv \<Gamma>\<^sub>\<Lambda>; fmpred (\<lambda>_. wellformed_clauses) css; Name name |\<in>| fmdom css\<rbrakk> \<Longrightarrow> wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f fmmap_keys (\<lambda>name cs. Vrecabs css name \<Gamma>\<^sub>\<Lambda>) css))
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<lbrakk>vwellformed v\<^sub>2; fmlookup css (Name name) = Some cs; wellformed_venv \<Gamma>\<^sub>\<Lambda>; fmpred (\<lambda>_. wellformed_clauses) css; Name name |\<in>| fmdom css\<rbrakk> \<Longrightarrow> wellformed_venv (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f fmmap_keys (\<lambda>name cs. Vrecabs css name \<Gamma>\<^sub>\<Lambda>) css)
2. \<lbrakk>vwellformed v\<^sub>2; fmlookup css (Name name) = Some cs; wellformed_venv \<Gamma>\<^sub>\<Lambda>; fmpred (\<lambda>_. wellformed_clauses) css; Name name |\<in>| fmdom css\<rbrakk> \<Longrightarrow> vwellformed v\<^sub>2
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. \<lbrakk>vwellformed v\<^sub>2; fmlookup css (Name name) = Some cs; wellformed_venv \<Gamma>\<^sub>\<Lambda>; fmpred (\<lambda>_. wellformed_clauses) css; Name name |\<in>| fmdom css\<rbrakk> \<Longrightarrow> wellformed_venv \<Gamma>\<^sub>\<Lambda>
2. \<lbrakk>vwellformed v\<^sub>2; fmlookup css (Name name) = Some cs; wellformed_venv \<Gamma>\<^sub>\<Lambda>; fmpred (\<lambda>_. wellformed_clauses) css; Name name |\<in>| fmdom css\<rbrakk> \<Longrightarrow> wellformed_venv (fmmap_keys (\<lambda>name cs. Vrecabs css name \<Gamma>\<^sub>\<Lambda>) css)
3. \<lbrakk>vwellformed v\<^sub>2; fmlookup css (Name name) = Some cs; wellformed_venv \<Gamma>\<^sub>\<Lambda>; fmpred (\<lambda>_. wellformed_clauses) css; Name name |\<in>| fmdom css\<rbrakk> \<Longrightarrow> vwellformed v\<^sub>2
[PROOF STEP]
apply (auto intro: fmdomI)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
goal (1 subgoal):
1. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
have "not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
using \<open>not_shadows_vconsts v\<^sub>1\<close> \<open>not_shadows_vconsts v\<^sub>2\<close>
[PROOF STATE]
proof (prove)
using this:
not_shadows_vconsts v\<^sub>1
not_shadows_vconsts v\<^sub>2
goal (1 subgoal):
1. not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
using \<open>fmlookup css (Name name) = Some cs\<close>
[PROOF STATE]
proof (prove)
using this:
not_shadows_vconsts v\<^sub>1
not_shadows_vconsts v\<^sub>2
fmlookup css (Name name) = Some cs
goal (1 subgoal):
1. not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
unfolding \<open>v\<^sub>1 = _\<close> mk_rec_env_def
[PROOF STATE]
proof (prove)
using this:
not_shadows_vconsts (Vrecabs css (Name name) \<Gamma>\<^sub>\<Lambda>)
not_shadows_vconsts v\<^sub>2
fmlookup css (Name name) = Some cs
goal (1 subgoal):
1. not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f fmmap_keys (\<lambda>name cs. Vrecabs css name \<Gamma>\<^sub>\<Lambda>) css))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>not_shadows_vconsts v\<^sub>2; fmlookup css (Name name) = Some cs; not_shadows_vconsts_env \<Gamma>\<^sub>\<Lambda>; fmpred (\<lambda>_. list_all (\<lambda>(pat, t). fdisjnt all_consts (frees pat) \<and> \<not> shadows_consts t)) css; Name name |\<in>| fmdom css\<rbrakk> \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f fmmap_keys (\<lambda>name cs. Vrecabs css name \<Gamma>\<^sub>\<Lambda>) css))
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<lbrakk>not_shadows_vconsts v\<^sub>2; fmlookup css (Name name) = Some cs; not_shadows_vconsts_env \<Gamma>\<^sub>\<Lambda>; fmpred (\<lambda>_. list_all (\<lambda>(pat, t). fdisjnt all_consts (frees pat) \<and> \<not> shadows_consts t)) css; Name name |\<in>| fmdom css\<rbrakk> \<Longrightarrow> not_shadows_vconsts_env (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f fmmap_keys (\<lambda>name cs. Vrecabs css name \<Gamma>\<^sub>\<Lambda>) css)
2. \<lbrakk>not_shadows_vconsts v\<^sub>2; fmlookup css (Name name) = Some cs; not_shadows_vconsts_env \<Gamma>\<^sub>\<Lambda>; fmpred (\<lambda>_. list_all (\<lambda>(pat, t). fdisjnt all_consts (frees pat) \<and> \<not> shadows_consts t)) css; Name name |\<in>| fmdom css\<rbrakk> \<Longrightarrow> not_shadows_vconsts v\<^sub>2
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. \<lbrakk>not_shadows_vconsts v\<^sub>2; fmlookup css (Name name) = Some cs; not_shadows_vconsts_env \<Gamma>\<^sub>\<Lambda>; fmpred (\<lambda>_. list_all (\<lambda>(pat, t). fdisjnt all_consts (frees pat) \<and> \<not> shadows_consts t)) css; Name name |\<in>| fmdom css\<rbrakk> \<Longrightarrow> not_shadows_vconsts_env \<Gamma>\<^sub>\<Lambda>
2. \<lbrakk>not_shadows_vconsts v\<^sub>2; fmlookup css (Name name) = Some cs; not_shadows_vconsts_env \<Gamma>\<^sub>\<Lambda>; fmpred (\<lambda>_. list_all (\<lambda>(pat, t). fdisjnt all_consts (frees pat) \<and> \<not> shadows_consts t)) css; Name name |\<in>| fmdom css\<rbrakk> \<Longrightarrow> not_shadows_vconsts_env (fmmap_keys (\<lambda>name cs. Vrecabs css name \<Gamma>\<^sub>\<Lambda>) css)
3. \<lbrakk>not_shadows_vconsts v\<^sub>2; fmlookup css (Name name) = Some cs; not_shadows_vconsts_env \<Gamma>\<^sub>\<Lambda>; fmpred (\<lambda>_. list_all (\<lambda>(pat, t). fdisjnt all_consts (frees pat) \<and> \<not> shadows_consts t)) css; Name name |\<in>| fmdom css\<rbrakk> \<Longrightarrow> not_shadows_vconsts v\<^sub>2
[PROOF STEP]
apply (auto intro: fmdomI)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
goal (1 subgoal):
1. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
have "fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
using \<open>vwelldefined' v\<^sub>1\<close> \<open>vwelldefined' v\<^sub>2\<close>
[PROOF STATE]
proof (prove)
using this:
vwelldefined' v\<^sub>1
vwelldefined' v\<^sub>2
goal (1 subgoal):
1. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
using \<open>fmlookup css (Name name) = Some cs\<close>
[PROOF STATE]
proof (prove)
using this:
vwelldefined' v\<^sub>1
vwelldefined' v\<^sub>2
fmlookup css (Name name) = Some cs
goal (1 subgoal):
1. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
unfolding \<open>v\<^sub>1 = _\<close> mk_rec_env_def
[PROOF STATE]
proof (prove)
using this:
vwelldefined' (Vrecabs css (Name name) \<Gamma>\<^sub>\<Lambda>)
vwelldefined' v\<^sub>2
fmlookup css (Name name) = Some cs
goal (1 subgoal):
1. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f fmmap_keys (\<lambda>name cs. Vrecabs css name \<Gamma>\<^sub>\<Lambda>) css))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>vwelldefined' v\<^sub>2; fmlookup css (Name name) = Some cs; fmpred (\<lambda>k. vwelldefined') \<Gamma>\<^sub>\<Lambda>; fmpred (\<lambda>_ cs. list_all (\<lambda>(pat, t). consts t |\<subseteq>| fmdom \<Gamma>\<^sub>\<Lambda> |\<union>| (C |\<union>| fmdom css)) cs \<and> fdisjnt C (fmdom \<Gamma>\<^sub>\<Lambda>)) css; Name name |\<in>| fmdom css; fdisjnt C (fmdom css)\<rbrakk> \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f fmmap_keys (\<lambda>name cs. Vrecabs css name \<Gamma>\<^sub>\<Lambda>) css))
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<lbrakk>vwelldefined' v\<^sub>2; fmlookup css (Name name) = Some cs; fmpred (\<lambda>k. vwelldefined') \<Gamma>\<^sub>\<Lambda>; fmpred (\<lambda>_ cs. list_all (\<lambda>(pat, t). consts t |\<subseteq>| fmdom \<Gamma>\<^sub>\<Lambda> |\<union>| (C |\<union>| fmdom css)) cs \<and> fdisjnt C (fmdom \<Gamma>\<^sub>\<Lambda>)) css; Name name |\<in>| fmdom css; fdisjnt C (fmdom css)\<rbrakk> \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f fmmap_keys (\<lambda>name cs. Vrecabs css name \<Gamma>\<^sub>\<Lambda>) css)
2. \<lbrakk>vwelldefined' v\<^sub>2; fmlookup css (Name name) = Some cs; fmpred (\<lambda>k. vwelldefined') \<Gamma>\<^sub>\<Lambda>; fmpred (\<lambda>_ cs. list_all (\<lambda>(pat, t). consts t |\<subseteq>| fmdom \<Gamma>\<^sub>\<Lambda> |\<union>| (C |\<union>| fmdom css)) cs \<and> fdisjnt C (fmdom \<Gamma>\<^sub>\<Lambda>)) css; Name name |\<in>| fmdom css; fdisjnt C (fmdom css)\<rbrakk> \<Longrightarrow> vwelldefined' v\<^sub>2
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. \<lbrakk>vwelldefined' v\<^sub>2; fmlookup css (Name name) = Some cs; fmpred (\<lambda>k. vwelldefined') \<Gamma>\<^sub>\<Lambda>; fmpred (\<lambda>_ cs. list_all (\<lambda>(pat, t). consts t |\<subseteq>| fmdom \<Gamma>\<^sub>\<Lambda> |\<union>| (C |\<union>| fmdom css)) cs \<and> fdisjnt C (fmdom \<Gamma>\<^sub>\<Lambda>)) css; Name name |\<in>| fmdom css; fdisjnt C (fmdom css)\<rbrakk> \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') \<Gamma>\<^sub>\<Lambda>
2. \<lbrakk>vwelldefined' v\<^sub>2; fmlookup css (Name name) = Some cs; fmpred (\<lambda>k. vwelldefined') \<Gamma>\<^sub>\<Lambda>; fmpred (\<lambda>_ cs. list_all (\<lambda>(pat, t). consts t |\<subseteq>| fmdom \<Gamma>\<^sub>\<Lambda> |\<union>| (C |\<union>| fmdom css)) cs \<and> fdisjnt C (fmdom \<Gamma>\<^sub>\<Lambda>)) css; Name name |\<in>| fmdom css; fdisjnt C (fmdom css)\<rbrakk> \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmmap_keys (\<lambda>name cs. Vrecabs css name \<Gamma>\<^sub>\<Lambda>) css)
3. \<lbrakk>vwelldefined' v\<^sub>2; fmlookup css (Name name) = Some cs; fmpred (\<lambda>k. vwelldefined') \<Gamma>\<^sub>\<Lambda>; fmpred (\<lambda>_ cs. list_all (\<lambda>(pat, t). consts t |\<subseteq>| fmdom \<Gamma>\<^sub>\<Lambda> |\<union>| (C |\<union>| fmdom css)) cs \<and> fdisjnt C (fmdom \<Gamma>\<^sub>\<Lambda>)) css; Name name |\<in>| fmdom css; fdisjnt C (fmdom css)\<rbrakk> \<Longrightarrow> vwelldefined' v\<^sub>2
[PROOF STEP]
apply (auto intro: fmdomI)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
goal (1 subgoal):
1. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
have "closed_except (Sabs cs) (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. closed_except (Sabs cs) (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
using \<open>vclosed v\<^sub>1\<close>
[PROOF STATE]
proof (prove)
using this:
vclosed v\<^sub>1
goal (1 subgoal):
1. closed_except (Sabs cs) (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
unfolding \<open>v\<^sub>1 = _\<close>
[PROOF STATE]
proof (prove)
using this:
vclosed (Vrecabs css (Name name) \<Gamma>\<^sub>\<Lambda>)
goal (1 subgoal):
1. closed_except (Sabs cs) (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
apply (auto simp: Sterm.closed_except_simps list_all_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<And>a b. \<lbrakk>(a, b) \<in> set cs; closed_venv \<Gamma>\<^sub>\<Lambda>; fmpred (\<lambda>_ cs. \<forall>x\<in>set cs. case x of (pat, t) \<Rightarrow> closed_except t (fmdom \<Gamma>\<^sub>\<Lambda> |\<union>| frees pat)) css; Name name |\<in>| fmdom css\<rbrakk> \<Longrightarrow> closed_except b (finsert (Name n) (fmdom \<Gamma>\<^sub>\<Lambda> |\<union>| frees a))
[PROOF STEP]
using \<open>fmlookup css (Name name) = Some cs\<close>
[PROOF STATE]
proof (prove)
using this:
fmlookup css (Name name) = Some cs
goal (1 subgoal):
1. \<And>a b. \<lbrakk>(a, b) \<in> set cs; closed_venv \<Gamma>\<^sub>\<Lambda>; fmpred (\<lambda>_ cs. \<forall>x\<in>set cs. case x of (pat, t) \<Rightarrow> closed_except t (fmdom \<Gamma>\<^sub>\<Lambda> |\<union>| frees pat)) css; Name name |\<in>| fmdom css\<rbrakk> \<Longrightarrow> closed_except b (finsert (Name n) (fmdom \<Gamma>\<^sub>\<Lambda> |\<union>| frees a))
[PROOF STEP]
apply (auto simp: closed_except_def dest!: fmpredD[where m = css])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
closed_except (Sabs cs) (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
goal (1 subgoal):
1. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
have "consts (Sabs cs) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| (C |\<union>| fmdom css)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. consts (Sabs cs) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| (C |\<union>| fmdom css)
[PROOF STEP]
using \<open>vwelldefined' v\<^sub>1\<close>
[PROOF STATE]
proof (prove)
using this:
vwelldefined' v\<^sub>1
goal (1 subgoal):
1. consts (Sabs cs) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| (C |\<union>| fmdom css)
[PROOF STEP]
unfolding \<open>v\<^sub>1 = _\<close>
[PROOF STATE]
proof (prove)
using this:
vwelldefined' (Vrecabs css (Name name) \<Gamma>\<^sub>\<Lambda>)
goal (1 subgoal):
1. consts (Sabs cs) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| (C |\<union>| fmdom css)
[PROOF STEP]
unfolding sconsts_sabs
[PROOF STATE]
proof (prove)
using this:
vwelldefined' (Vrecabs css (Name name) \<Gamma>\<^sub>\<Lambda>)
goal (1 subgoal):
1. list_all (\<lambda>(uu_, t). consts t |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| (C |\<union>| fmdom css)) cs
[PROOF STEP]
using \<open>fmlookup css (Name name) = Some cs\<close>
[PROOF STATE]
proof (prove)
using this:
vwelldefined' (Vrecabs css (Name name) \<Gamma>\<^sub>\<Lambda>)
fmlookup css (Name name) = Some cs
goal (1 subgoal):
1. list_all (\<lambda>(uu_, t). consts t |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| (C |\<union>| fmdom css)) cs
[PROOF STEP]
by (auto simp: list_all_iff dest!: fmpredD[where m = css])
[PROOF STATE]
proof (state)
this:
consts (Sabs cs) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| (C |\<union>| fmdom css)
goal (1 subgoal):
1. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
have "\<not> shadows_consts (Sabs cs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<not> shadows_consts (Sabs cs)
[PROOF STEP]
using \<open>not_shadows_vconsts v\<^sub>1\<close>
[PROOF STATE]
proof (prove)
using this:
not_shadows_vconsts v\<^sub>1
goal (1 subgoal):
1. \<not> shadows_consts (Sabs cs)
[PROOF STEP]
unfolding \<open>v\<^sub>1 = _\<close>
[PROOF STATE]
proof (prove)
using this:
not_shadows_vconsts (Vrecabs css (Name name) \<Gamma>\<^sub>\<Lambda>)
goal (1 subgoal):
1. \<not> shadows_consts (Sabs cs)
[PROOF STEP]
using \<open>fmlookup css (Name name) = Some cs\<close>
[PROOF STATE]
proof (prove)
using this:
not_shadows_vconsts (Vrecabs css (Name name) \<Gamma>\<^sub>\<Lambda>)
fmlookup css (Name name) = Some cs
goal (1 subgoal):
1. \<not> shadows_consts (Sabs cs)
[PROOF STEP]
by (auto simp: list_all_iff list_ex_iff)
[PROOF STATE]
proof (state)
this:
\<not> shadows_consts (Sabs cs)
goal (1 subgoal):
1. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
have "fdisjnt C (fmdom \<Gamma>\<^sub>\<Lambda>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fdisjnt C (fmdom \<Gamma>\<^sub>\<Lambda>)
[PROOF STEP]
using \<open>vwelldefined' v\<^sub>1\<close>
[PROOF STATE]
proof (prove)
using this:
vwelldefined' v\<^sub>1
goal (1 subgoal):
1. fdisjnt C (fmdom \<Gamma>\<^sub>\<Lambda>)
[PROOF STEP]
unfolding \<open>v\<^sub>1 = _\<close>
[PROOF STATE]
proof (prove)
using this:
vwelldefined' (Vrecabs css (Name name) \<Gamma>\<^sub>\<Lambda>)
goal (1 subgoal):
1. fdisjnt C (fmdom \<Gamma>\<^sub>\<Lambda>)
[PROOF STEP]
using \<open>fmlookup css (Name name) = Some cs\<close>
[PROOF STATE]
proof (prove)
using this:
vwelldefined' (Vrecabs css (Name name) \<Gamma>\<^sub>\<Lambda>)
fmlookup css (Name name) = Some cs
goal (1 subgoal):
1. fdisjnt C (fmdom \<Gamma>\<^sub>\<Lambda>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
fdisjnt C (fmdom \<Gamma>\<^sub>\<Lambda>)
goal (1 subgoal):
1. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
have "if_rval (\<lambda>ml_v. \<exists>v. fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) \<turnstile>\<^sub>v Sabs cs $\<^sub>s Svar (Name n) \<down> v \<and> related_v v ml_v) bv"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. if_rval (\<lambda>ml_v. \<exists>v. fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) \<turnstile>\<^sub>v Sabs cs $\<^sub>s Svar (Name n) \<down> v \<and> related_v v ml_v) bv
[PROOF STEP]
proof (rule app1(2))
[PROOF STATE]
proof (state)
goal (12 subgoals):
1. is_cupcake_all_env env'
2. fmrel_on_fset (ids (Sabs cs $\<^sub>s Svar (Name n))) related_v (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)) (fmap_of_ns (sem_env.v env'))
3. related_exp (Sabs cs $\<^sub>s Svar (Name n)) exp'
4. pre_strong_term_class.wellformed (Sabs cs $\<^sub>s Svar (Name n))
5. wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
6. closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
7. closed_except (Sabs cs $\<^sub>s Svar (Name n)) (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))
8. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
9. consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)) |\<union>| C
10. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))
A total of 12 subgoals...
[PROOF STEP]
have "fmrel_on_fset (ids (Sabs cs)) related_v \<Gamma>\<^sub>\<Lambda> (fmap_of_ns (sem_env.v env\<^sub>\<Lambda>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmrel_on_fset (ids (Sabs cs)) related_v \<Gamma>\<^sub>\<Lambda> (fmap_of_ns (sem_env.v env\<^sub>\<Lambda>))
[PROOF STEP]
apply (rule fmrel_on_fsubset)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. fmrel_on_fset ?S related_v \<Gamma>\<^sub>\<Lambda> (fmap_of_ns (sem_env.v env\<^sub>\<Lambda>))
2. ids (Sabs cs) |\<subseteq>| ?S
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. ids (Sabs cs) |\<subseteq>| fbind (fmran css) (ids \<circ> Sabs)
[PROOF STEP]
apply (subst funion_image_bind_eq[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. ids (Sabs cs) |\<subseteq>| ffUnion ((ids \<circ> Sabs) |`| fmran css)
[PROOF STEP]
apply (rule ffUnion_subset_elem)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. ids (Sabs cs) |\<in>| (ids \<circ> Sabs) |`| fmran css
[PROOF STEP]
apply (subst fimage_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fBex (fmran css) (\<lambda>x. ids (Sabs cs) = (ids \<circ> Sabs) x)
[PROOF STEP]
apply (rule fBexI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. ids (Sabs cs) = (ids \<circ> Sabs) ?x6
2. ?x6 |\<in>| fmran css
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. cs |\<in>| fmran css
[PROOF STEP]
apply (rule fmranI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmlookup css ?x10 = Some cs
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
fmrel_on_fset (ids (Sabs cs)) related_v \<Gamma>\<^sub>\<Lambda> (fmap_of_ns (sem_env.v env\<^sub>\<Lambda>))
goal (12 subgoals):
1. is_cupcake_all_env env'
2. fmrel_on_fset (ids (Sabs cs $\<^sub>s Svar (Name n))) related_v (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)) (fmap_of_ns (sem_env.v env'))
3. related_exp (Sabs cs $\<^sub>s Svar (Name n)) exp'
4. pre_strong_term_class.wellformed (Sabs cs $\<^sub>s Svar (Name n))
5. wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
6. closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
7. closed_except (Sabs cs $\<^sub>s Svar (Name n)) (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))
8. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
9. consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)) |\<union>| C
10. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))
A total of 12 subgoals...
[PROOF STEP]
have "fmrel_on_fset (ids (Sabs cs)) related_v (mk_rec_env css \<Gamma>\<^sub>\<Lambda>) (cake_mk_rec_env funs env\<^sub>\<Lambda>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmrel_on_fset (ids (Sabs cs)) related_v (mk_rec_env css \<Gamma>\<^sub>\<Lambda>) (cake_mk_rec_env funs env\<^sub>\<Lambda>)
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<And>x. x |\<in>| ids (Sabs cs) \<Longrightarrow> rel_option related_v (fmlookup (mk_rec_env css \<Gamma>\<^sub>\<Lambda>) x) (fmlookup (cake_mk_rec_env funs env\<^sub>\<Lambda>) x)
[PROOF STEP]
apply (rule mk_rec_env_related[THEN fmrelD])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<And>x. x |\<in>| ids (Sabs cs) \<Longrightarrow> fmrel (\<lambda>cs (n, e). related_fun cs n e) css (fmap_of_list (map (map_prod Name (map_prod Name id)) funs))
2. \<And>x. x |\<in>| ids (Sabs cs) \<Longrightarrow> fmrel_on_fset (fbind (fmran css) (ids \<circ> Sabs)) related_v \<Gamma>\<^sub>\<Lambda> (fmap_of_ns (sem_env.v env\<^sub>\<Lambda>))
[PROOF STEP]
apply (rule \<open>fmrel _ css _\<close>)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<And>x. x |\<in>| ids (Sabs cs) \<Longrightarrow> fmrel_on_fset (fbind (fmran css) (ids \<circ> Sabs)) related_v \<Gamma>\<^sub>\<Lambda> (fmap_of_ns (sem_env.v env\<^sub>\<Lambda>))
[PROOF STEP]
apply (rule \<open>fmrel_on_fset (fbind _ _) related_v \<Gamma>\<^sub>\<Lambda> _\<close>)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
fmrel_on_fset (ids (Sabs cs)) related_v (mk_rec_env css \<Gamma>\<^sub>\<Lambda>) (cake_mk_rec_env funs env\<^sub>\<Lambda>)
goal (12 subgoals):
1. is_cupcake_all_env env'
2. fmrel_on_fset (ids (Sabs cs $\<^sub>s Svar (Name n))) related_v (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)) (fmap_of_ns (sem_env.v env'))
3. related_exp (Sabs cs $\<^sub>s Svar (Name n)) exp'
4. pre_strong_term_class.wellformed (Sabs cs $\<^sub>s Svar (Name n))
5. wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
6. closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
7. closed_except (Sabs cs $\<^sub>s Svar (Name n)) (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))
8. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
9. consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)) |\<union>| C
10. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))
A total of 12 subgoals...
[PROOF STEP]
show "fmrel_on_fset (ids (Sabs cs $\<^sub>s Svar (Name n))) related_v (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)) (fmap_of_ns (sem_env.v env'))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmrel_on_fset (ids (Sabs cs $\<^sub>s Svar (Name n))) related_v (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)) (fmap_of_ns (sem_env.v env'))
[PROOF STEP]
unfolding recclosure'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmrel_on_fset (ids (Sabs cs $\<^sub>s Svar (Name n))) related_v (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)) (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsBind (as_string (Name n)) ml_v\<^sub>2 (build_rec_env funs env\<^sub>\<Lambda> (sem_env.v env\<^sub>\<Lambda>))) env\<^sub>\<Lambda>)))
[PROOF STEP]
apply (simp del: frees_sterm.simps(3) consts_sterm.simps(3) name.sel add: ids_def split!: sem_env.splits)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmrel_on_fset (finsert (Name n) (frees (Sabs cs) |\<union>| consts (Sabs cs))) related_v (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)) (fmupd (Name n) ml_v\<^sub>2 (fmap_of_ns (build_rec_env funs env\<^sub>\<Lambda> (sem_env.v env\<^sub>\<Lambda>))))
[PROOF STEP]
apply (rule fmrel_on_fset_updateI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. fmrel_on_fset (frees (Sabs cs) |\<union>| consts (Sabs cs)) related_v (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) (fmap_of_ns (build_rec_env funs env\<^sub>\<Lambda> (sem_env.v env\<^sub>\<Lambda>)))
2. related_v v\<^sub>2 ml_v\<^sub>2
[PROOF STEP]
unfolding build_rec_env_fmap
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. fmrel_on_fset (frees (Sabs cs) |\<union>| consts (Sabs cs)) related_v (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) (fmap_of_ns (sem_env.v env\<^sub>\<Lambda>) ++\<^sub>f cake_mk_rec_env funs env\<^sub>\<Lambda>)
2. related_v v\<^sub>2 ml_v\<^sub>2
[PROOF STEP]
apply (rule fmrel_on_fset_addI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. fmrel_on_fset (frees (Sabs cs) |\<union>| consts (Sabs cs)) related_v \<Gamma>\<^sub>\<Lambda> (fmap_of_ns (sem_env.v env\<^sub>\<Lambda>))
2. fmrel_on_fset (frees (Sabs cs) |\<union>| consts (Sabs cs)) related_v (mk_rec_env css \<Gamma>\<^sub>\<Lambda>) (cake_mk_rec_env funs env\<^sub>\<Lambda>)
3. related_v v\<^sub>2 ml_v\<^sub>2
[PROOF STEP]
apply (fold ids_def)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. fmrel_on_fset (ids (Sabs cs)) related_v \<Gamma>\<^sub>\<Lambda> (fmap_of_ns (sem_env.v env\<^sub>\<Lambda>))
2. fmrel_on_fset (ids (Sabs cs)) related_v (mk_rec_env css \<Gamma>\<^sub>\<Lambda>) (cake_mk_rec_env funs env\<^sub>\<Lambda>)
3. related_v v\<^sub>2 ml_v\<^sub>2
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmrel_on_fset (ids (Sabs cs)) related_v \<Gamma>\<^sub>\<Lambda> (fmap_of_ns (sem_env.v env\<^sub>\<Lambda>))
[PROOF STEP]
using \<open>fmrel_on_fset (ids (Sabs cs)) related_v \<Gamma>\<^sub>\<Lambda> _\<close>
[PROOF STATE]
proof (prove)
using this:
fmrel_on_fset (ids (Sabs cs)) related_v \<Gamma>\<^sub>\<Lambda> (fmap_of_ns (sem_env.v env\<^sub>\<Lambda>))
goal (1 subgoal):
1. fmrel_on_fset (ids (Sabs cs)) related_v \<Gamma>\<^sub>\<Lambda> (fmap_of_ns (sem_env.v env\<^sub>\<Lambda>))
[PROOF STEP]
by simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. fmrel_on_fset (ids (Sabs cs)) related_v (mk_rec_env css \<Gamma>\<^sub>\<Lambda>) (cake_mk_rec_env funs env\<^sub>\<Lambda>)
2. related_v v\<^sub>2 ml_v\<^sub>2
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmrel_on_fset (ids (Sabs cs)) related_v (mk_rec_env css \<Gamma>\<^sub>\<Lambda>) (cake_mk_rec_env funs env\<^sub>\<Lambda>)
[PROOF STEP]
using \<open>fmrel_on_fset (ids (Sabs cs)) related_v (mk_rec_env css \<Gamma>\<^sub>\<Lambda>) _\<close>
[PROOF STATE]
proof (prove)
using this:
fmrel_on_fset (ids (Sabs cs)) related_v (mk_rec_env css \<Gamma>\<^sub>\<Lambda>) (cake_mk_rec_env funs env\<^sub>\<Lambda>)
goal (1 subgoal):
1. fmrel_on_fset (ids (Sabs cs)) related_v (mk_rec_env css \<Gamma>\<^sub>\<Lambda>) (cake_mk_rec_env funs env\<^sub>\<Lambda>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. related_v v\<^sub>2 ml_v\<^sub>2
[PROOF STEP]
apply (rule \<open>related_v v\<^sub>2 ml_v\<^sub>2\<close>)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
fmrel_on_fset (ids (Sabs cs $\<^sub>s Svar (Name n))) related_v (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)) (fmap_of_ns (sem_env.v env'))
goal (11 subgoals):
1. is_cupcake_all_env env'
2. related_exp (Sabs cs $\<^sub>s Svar (Name n)) exp'
3. pre_strong_term_class.wellformed (Sabs cs $\<^sub>s Svar (Name n))
4. wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
5. closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
6. closed_except (Sabs cs $\<^sub>s Svar (Name n)) (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))
7. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
8. consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)) |\<union>| C
9. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))
10. \<not> shadows_consts (Sabs cs $\<^sub>s Svar (Name n))
A total of 11 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (11 subgoals):
1. is_cupcake_all_env env'
2. related_exp (Sabs cs $\<^sub>s Svar (Name n)) exp'
3. pre_strong_term_class.wellformed (Sabs cs $\<^sub>s Svar (Name n))
4. wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
5. closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
6. closed_except (Sabs cs $\<^sub>s Svar (Name n)) (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))
7. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
8. consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)) |\<union>| C
9. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))
10. \<not> shadows_consts (Sabs cs $\<^sub>s Svar (Name n))
A total of 11 subgoals...
[PROOF STEP]
show "wellformed (Sabs cs $\<^sub>s Svar (Name n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. pre_strong_term_class.wellformed (Sabs cs $\<^sub>s Svar (Name n))
[PROOF STEP]
using \<open>vwellformed v\<^sub>1\<close>
[PROOF STATE]
proof (prove)
using this:
vwellformed v\<^sub>1
goal (1 subgoal):
1. pre_strong_term_class.wellformed (Sabs cs $\<^sub>s Svar (Name n))
[PROOF STEP]
unfolding \<open>v\<^sub>1 = _\<close>
[PROOF STATE]
proof (prove)
using this:
vwellformed (Vrecabs css (Name name) \<Gamma>\<^sub>\<Lambda>)
goal (1 subgoal):
1. pre_strong_term_class.wellformed (Sabs cs $\<^sub>s Svar (Name n))
[PROOF STEP]
using \<open>fmlookup css (Name name) = Some cs\<close>
[PROOF STATE]
proof (prove)
using this:
vwellformed (Vrecabs css (Name name) \<Gamma>\<^sub>\<Lambda>)
fmlookup css (Name name) = Some cs
goal (1 subgoal):
1. pre_strong_term_class.wellformed (Sabs cs $\<^sub>s Svar (Name n))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
pre_strong_term_class.wellformed (Sabs cs $\<^sub>s Svar (Name n))
goal (10 subgoals):
1. is_cupcake_all_env env'
2. related_exp (Sabs cs $\<^sub>s Svar (Name n)) exp'
3. wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
4. closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
5. closed_except (Sabs cs $\<^sub>s Svar (Name n)) (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))
6. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
7. consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)) |\<union>| C
8. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))
9. \<not> shadows_consts (Sabs cs $\<^sub>s Svar (Name n))
10. not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (10 subgoals):
1. is_cupcake_all_env env'
2. related_exp (Sabs cs $\<^sub>s Svar (Name n)) exp'
3. wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
4. closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
5. closed_except (Sabs cs $\<^sub>s Svar (Name n)) (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))
6. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
7. consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)) |\<union>| C
8. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))
9. \<not> shadows_consts (Sabs cs $\<^sub>s Svar (Name n))
10. not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
show "related_exp (Sabs cs $\<^sub>s Svar (Name n)) exp'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. related_exp (Sabs cs $\<^sub>s Svar (Name n)) exp'
[PROOF STEP]
unfolding \<open>exp' = _\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. related_exp (Sabs cs $\<^sub>s Svar (Name n)) (Mat (Var (Short (as_string (Name n)))) ml_cs)
[PROOF STEP]
apply (rule related_exp.intros)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. list_all2 (rel_prod related_pat related_exp) cs ml_cs
2. related_exp (Svar (Name n)) (Var (Short (as_string (Name n))))
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. related_exp (Svar (Name n)) (Var (Short (as_string (Name n))))
[PROOF STEP]
apply (rule related_exp.intros)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
related_exp (Sabs cs $\<^sub>s Svar (Name n)) exp'
goal (9 subgoals):
1. is_cupcake_all_env env'
2. wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
3. closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
4. closed_except (Sabs cs $\<^sub>s Svar (Name n)) (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))
5. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
6. consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)) |\<union>| C
7. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))
8. \<not> shadows_consts (Sabs cs $\<^sub>s Svar (Name n))
9. not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (9 subgoals):
1. is_cupcake_all_env env'
2. wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
3. closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
4. closed_except (Sabs cs $\<^sub>s Svar (Name n)) (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))
5. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
6. consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)) |\<union>| C
7. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))
8. \<not> shadows_consts (Sabs cs $\<^sub>s Svar (Name n))
9. not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
show "closed_except (Sabs cs $\<^sub>s Svar (Name n)) (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. closed_except (Sabs cs $\<^sub>s Svar (Name n)) (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))
[PROOF STEP]
using \<open>closed_except (Sabs cs) (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))\<close>
[PROOF STATE]
proof (prove)
using this:
closed_except (Sabs cs) (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
goal (1 subgoal):
1. closed_except (Sabs cs $\<^sub>s Svar (Name n)) (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))
[PROOF STEP]
by (auto simp: list_all_iff closed_except_def)
[PROOF STATE]
proof (state)
this:
closed_except (Sabs cs $\<^sub>s Svar (Name n)) (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))
goal (8 subgoals):
1. is_cupcake_all_env env'
2. wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
3. closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
4. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
5. consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)) |\<union>| C
6. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))
7. \<not> shadows_consts (Sabs cs $\<^sub>s Svar (Name n))
8. not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (8 subgoals):
1. is_cupcake_all_env env'
2. wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
3. closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
4. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
5. consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)) |\<union>| C
6. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))
7. \<not> shadows_consts (Sabs cs $\<^sub>s Svar (Name n))
8. not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
show "\<not> shadows_consts (Sabs cs $\<^sub>s Svar (Name n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<not> shadows_consts (Sabs cs $\<^sub>s Svar (Name n))
[PROOF STEP]
using \<open>\<not> shadows_consts (Sabs cs)\<close> \<open>Name n |\<notin>| all_consts\<close>
[PROOF STATE]
proof (prove)
using this:
\<not> shadows_consts (Sabs cs)
Name n |\<notin>| all_consts
goal (1 subgoal):
1. \<not> shadows_consts (Sabs cs $\<^sub>s Svar (Name n))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<not> shadows_consts (Sabs cs $\<^sub>s Svar (Name n))
goal (7 subgoals):
1. is_cupcake_all_env env'
2. wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
3. closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
4. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
5. consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)) |\<union>| C
6. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))
7. not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (7 subgoals):
1. is_cupcake_all_env env'
2. wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
3. closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
4. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
5. consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)) |\<union>| C
6. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))
7. not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
show "consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)) |\<union>| C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)) |\<union>| C
[PROOF STEP]
using \<open>consts (Sabs cs) |\<subseteq>| _\<close>
[PROOF STATE]
proof (prove)
using this:
consts (Sabs cs) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| (C |\<union>| fmdom css)
goal (1 subgoal):
1. consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)) |\<union>| C
[PROOF STEP]
unfolding mk_rec_env_def
[PROOF STATE]
proof (prove)
using this:
consts (Sabs cs) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| (C |\<union>| fmdom css)
goal (1 subgoal):
1. consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f fmmap_keys (\<lambda>name cs. Vrecabs css name \<Gamma>\<^sub>\<Lambda>) css)) |\<union>| C
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
consts (Sabs cs $\<^sub>s Svar (Name n)) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)) |\<union>| C
goal (6 subgoals):
1. is_cupcake_all_env env'
2. wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
3. closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
4. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
5. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))
6. not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (6 subgoals):
1. is_cupcake_all_env env'
2. wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
3. closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
4. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
5. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))
6. not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
show "fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))
[PROOF STEP]
using \<open>Name n |\<notin>| all_consts\<close> \<open>fdisjnt C (fmdom \<Gamma>\<^sub>\<Lambda>)\<close> \<open>vwelldefined' v\<^sub>1\<close>
[PROOF STATE]
proof (prove)
using this:
Name n |\<notin>| all_consts
fdisjnt C (fmdom \<Gamma>\<^sub>\<Lambda>)
vwelldefined' v\<^sub>1
goal (1 subgoal):
1. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))
[PROOF STEP]
unfolding mk_rec_env_def \<open>v\<^sub>1 = _\<close>
[PROOF STATE]
proof (prove)
using this:
Name n |\<notin>| all_consts
fdisjnt C (fmdom \<Gamma>\<^sub>\<Lambda>)
vwelldefined' (Vrecabs css (Name name) \<Gamma>\<^sub>\<Lambda>)
goal (1 subgoal):
1. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f fmmap_keys (\<lambda>name cs. Vrecabs css name \<Gamma>\<^sub>\<Lambda>) css)))
[PROOF STEP]
by (auto simp: fdisjnt_alt_def all_consts_def)
[PROOF STATE]
proof (state)
this:
fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>)))
goal (5 subgoals):
1. is_cupcake_all_env env'
2. wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
3. closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
4. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
5. not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
[PROOF STEP]
qed fact+
[PROOF STATE]
proof (state)
this:
if_rval (\<lambda>ml_v. \<exists>v. fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) \<turnstile>\<^sub>v Sabs cs $\<^sub>s Svar (Name n) \<down> v \<and> related_v v ml_v) bv
goal (1 subgoal):
1. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
if_rval (\<lambda>ml_v. \<exists>v. fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) \<turnstile>\<^sub>v Sabs cs $\<^sub>s Svar (Name n) \<down> v \<and> related_v v ml_v) bv
[PROOF STEP]
obtain v
where "fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) \<turnstile>\<^sub>v Sabs cs $\<^sub>s Svar (Name n) \<down> v" "related_v v ml_v"
[PROOF STATE]
proof (prove)
using this:
if_rval (\<lambda>ml_v. \<exists>v. fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) \<turnstile>\<^sub>v Sabs cs $\<^sub>s Svar (Name n) \<down> v \<and> related_v v ml_v) bv
goal (1 subgoal):
1. (\<And>v. \<lbrakk>fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) \<turnstile>\<^sub>v Sabs cs $\<^sub>s Svar (Name n) \<down> v; related_v v ml_v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding \<open>bv = _\<close>
[PROOF STATE]
proof (prove)
using this:
if_rval (\<lambda>ml_v. \<exists>v. fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) \<turnstile>\<^sub>v Sabs cs $\<^sub>s Svar (Name n) \<down> v \<and> related_v v ml_v) (Rval ml_v)
goal (1 subgoal):
1. (\<And>v. \<lbrakk>fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) \<turnstile>\<^sub>v Sabs cs $\<^sub>s Svar (Name n) \<down> v; related_v v ml_v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) \<turnstile>\<^sub>v Sabs cs $\<^sub>s Svar (Name n) \<down> v
related_v v ml_v
goal (1 subgoal):
1. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) \<turnstile>\<^sub>v Sabs cs $\<^sub>s Svar (Name n) \<down> v
related_v v ml_v
[PROOF STEP]
obtain env pat rhs
where "vfind_match cs v\<^sub>2 = Some (env, pat, rhs)"
and "fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v"
[PROOF STATE]
proof (prove)
using this:
fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) \<turnstile>\<^sub>v Sabs cs $\<^sub>s Svar (Name n) \<down> v
related_v v ml_v
goal (1 subgoal):
1. (\<And>env pat rhs. \<lbrakk>vfind_match cs v\<^sub>2 = Some (env, pat, rhs); fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto elim: veval'_sabs_svarE)
[PROOF STATE]
proof (state)
this:
vfind_match cs v\<^sub>2 = Some (env, pat, rhs)
fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v
goal (1 subgoal):
1. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
hence "(pat, rhs) \<in> set cs" "vmatch (mk_pat pat) v\<^sub>2 = Some env"
[PROOF STATE]
proof (prove)
using this:
vfind_match cs v\<^sub>2 = Some (env, pat, rhs)
fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v
goal (1 subgoal):
1. (pat, rhs) \<in> set cs &&& vmatch (mk_pat pat) v\<^sub>2 = Some env
[PROOF STEP]
by (metis vfind_match_elem)+
[PROOF STATE]
proof (state)
this:
(pat, rhs) \<in> set cs
vmatch (mk_pat pat) v\<^sub>2 = Some env
goal (1 subgoal):
1. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
hence "linear pat" "wellformed rhs"
[PROOF STATE]
proof (prove)
using this:
(pat, rhs) \<in> set cs
vmatch (mk_pat pat) v\<^sub>2 = Some env
goal (1 subgoal):
1. Pats.linear pat &&& pre_strong_term_class.wellformed rhs
[PROOF STEP]
using \<open>vwellformed v\<^sub>1\<close>
[PROOF STATE]
proof (prove)
using this:
(pat, rhs) \<in> set cs
vmatch (mk_pat pat) v\<^sub>2 = Some env
vwellformed v\<^sub>1
goal (1 subgoal):
1. Pats.linear pat &&& pre_strong_term_class.wellformed rhs
[PROOF STEP]
unfolding \<open>v\<^sub>1 = _\<close>
[PROOF STATE]
proof (prove)
using this:
(pat, rhs) \<in> set cs
vmatch (mk_pat pat) v\<^sub>2 = Some env
vwellformed (Vrecabs css (Name name) \<Gamma>\<^sub>\<Lambda>)
goal (1 subgoal):
1. Pats.linear pat &&& pre_strong_term_class.wellformed rhs
[PROOF STEP]
using \<open>fmlookup css (Name name) = Some cs\<close>
[PROOF STATE]
proof (prove)
using this:
(pat, rhs) \<in> set cs
vmatch (mk_pat pat) v\<^sub>2 = Some env
vwellformed (Vrecabs css (Name name) \<Gamma>\<^sub>\<Lambda>)
fmlookup css (Name name) = Some cs
goal (1 subgoal):
1. Pats.linear pat &&& pre_strong_term_class.wellformed rhs
[PROOF STEP]
by (auto simp: list_all_iff)
[PROOF STATE]
proof (state)
this:
Pats.linear pat
pre_strong_term_class.wellformed rhs
goal (1 subgoal):
1. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
hence "frees pat = patvars (mk_pat pat)"
[PROOF STATE]
proof (prove)
using this:
Pats.linear pat
pre_strong_term_class.wellformed rhs
goal (1 subgoal):
1. frees pat = patvars (mk_pat pat)
[PROOF STEP]
by (simp add: mk_pat_frees)
[PROOF STATE]
proof (state)
this:
frees pat = patvars (mk_pat pat)
goal (1 subgoal):
1. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
hence "fmdom env = frees pat"
[PROOF STATE]
proof (prove)
using this:
frees pat = patvars (mk_pat pat)
goal (1 subgoal):
1. fmdom env = frees pat
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. frees pat = patvars (mk_pat pat) \<Longrightarrow> fmdom env = patvars (mk_pat pat)
[PROOF STEP]
apply (rule vmatch_dom)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. frees pat = patvars (mk_pat pat) \<Longrightarrow> vmatch (mk_pat pat) ?v1 = Some env
[PROOF STEP]
apply (rule \<open>vmatch (mk_pat pat) v\<^sub>2 = Some env\<close>)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
fmdom env = frees pat
goal (1 subgoal):
1. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
obtain v' where "\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'" "v' \<approx>\<^sub>e v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof (rule veval'_agree_eq)
[PROOF STATE]
proof (state)
goal (12 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> ?\<Gamma>6 \<turnstile>\<^sub>v ?t6 \<down> ?v6
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmrel_on_fset (ids ?t6) erelated ?\<Gamma>'6 ?\<Gamma>6
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_venv ?\<Gamma>6
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except ?t6 (fmdom ?\<Gamma>6)
5. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed ?t6
6. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> wellformed_venv ?\<Gamma>6
7. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom ?\<Gamma>6)
8. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts ?t6 |\<subseteq>| fmdom ?\<Gamma>6 |\<union>| C
9. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') ?\<Gamma>6
10. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts ?t6
A total of 12 subgoals...
[PROOF STEP]
show "fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v
goal (11 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmrel_on_fset (ids rhs) erelated ?\<Gamma>'6 (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
5. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
6. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
7. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env) |\<union>| C
8. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
9. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
10. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
A total of 11 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (11 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmrel_on_fset (ids rhs) erelated ?\<Gamma>'6 (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
5. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
6. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
7. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env) |\<union>| C
8. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
9. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
10. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
A total of 11 subgoals...
[PROOF STEP]
have *: "Name n |\<notin>| ids rhs" if "Name n |\<notin>| fmdom env"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. Name n |\<notin>| ids rhs
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. Name n |\<in>| ids rhs \<Longrightarrow> False
[PROOF STEP]
assume "Name n |\<in>| ids rhs"
[PROOF STATE]
proof (state)
this:
Name n |\<in>| ids rhs
goal (1 subgoal):
1. Name n |\<in>| ids rhs \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
Name n |\<in>| ids rhs
goal (1 subgoal):
1. False
[PROOF STEP]
unfolding ids_def
[PROOF STATE]
proof (prove)
using this:
Name n |\<in>| frees rhs |\<union>| consts rhs
goal (1 subgoal):
1. False
[PROOF STEP]
proof (cases rule: funion_strictE)
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. Name n |\<in>| frees rhs \<Longrightarrow> False
2. \<lbrakk>Name n |\<notin>| frees rhs; Name n |\<in>| consts rhs\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
case A
[PROOF STATE]
proof (state)
this:
Name n |\<in>| frees rhs
goal (2 subgoals):
1. Name n |\<in>| frees rhs \<Longrightarrow> False
2. \<lbrakk>Name n |\<notin>| frees rhs; Name n |\<in>| consts rhs\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Name n |\<in>| frees rhs
goal (2 subgoals):
1. Name n |\<in>| frees rhs \<Longrightarrow> False
2. \<lbrakk>Name n |\<notin>| frees rhs; Name n |\<in>| consts rhs\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "Name n |\<notin>| frees pat"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. Name n |\<notin>| frees pat
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
Name n |\<notin>| fmdom env
goal (1 subgoal):
1. Name n |\<notin>| frees pat
[PROOF STEP]
unfolding \<open>fmdom env = frees pat\<close>
[PROOF STATE]
proof (prove)
using this:
Name n |\<notin>| frees pat
goal (1 subgoal):
1. Name n |\<notin>| frees pat
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Name n |\<notin>| frees pat
goal (2 subgoals):
1. Name n |\<in>| frees rhs \<Longrightarrow> False
2. \<lbrakk>Name n |\<notin>| frees rhs; Name n |\<in>| consts rhs\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Name n |\<in>| frees rhs
Name n |\<notin>| frees pat
[PROOF STEP]
have "Name n |\<in>| frees (Sabs cs)"
[PROOF STATE]
proof (prove)
using this:
Name n |\<in>| frees rhs
Name n |\<notin>| frees pat
goal (1 subgoal):
1. Name n |\<in>| frees (Sabs cs)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>Name n |\<in>| frees rhs; Name n |\<notin>| frees pat\<rbrakk> \<Longrightarrow> Name n |\<in>| ffUnion ((\<lambda>(pat, rhs). frees rhs |-| frees pat) |`| fset_of_list cs)
[PROOF STEP]
unfolding ffUnion_alt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>Name n |\<in>| frees rhs; Name n |\<notin>| frees pat\<rbrakk> \<Longrightarrow> fBex ((\<lambda>(pat, rhs). frees rhs |-| frees pat) |`| fset_of_list cs) ((|\<in>|) (Name n))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>Name n |\<in>| frees rhs; Name n |\<notin>| frees pat\<rbrakk> \<Longrightarrow> fBex (fset_of_list cs) (\<lambda>x. Name n |\<in>| (case x of (pat, rhs) \<Rightarrow> frees rhs |-| frees pat))
[PROOF STEP]
apply (rule fBexI[where x = "(pat, rhs)"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<lbrakk>Name n |\<in>| frees rhs; Name n |\<notin>| frees pat\<rbrakk> \<Longrightarrow> Name n |\<in>| (case (pat, rhs) of (pat, rhs) \<Rightarrow> frees rhs |-| frees pat)
2. \<lbrakk>Name n |\<in>| frees rhs; Name n |\<notin>| frees pat\<rbrakk> \<Longrightarrow> (pat, rhs) |\<in>| fset_of_list cs
[PROOF STEP]
apply (auto simp: fset_of_list_elem)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>Name n |\<in>| frees rhs; Name n |\<notin>| frees pat\<rbrakk> \<Longrightarrow> (pat, rhs) \<in> set cs
[PROOF STEP]
apply (rule \<open>(pat, rhs) \<in> set cs\<close>)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
Name n |\<in>| frees (Sabs cs)
goal (2 subgoals):
1. Name n |\<in>| frees rhs \<Longrightarrow> False
2. \<lbrakk>Name n |\<notin>| frees rhs; Name n |\<in>| consts rhs\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Name n |\<in>| frees (Sabs cs)
goal (1 subgoal):
1. False
[PROOF STEP]
using \<open>Name n |\<notin>| ids (Sabs cs)\<close>
[PROOF STATE]
proof (prove)
using this:
Name n |\<in>| frees (Sabs cs)
Name n |\<notin>| ids (Sabs cs)
goal (1 subgoal):
1. False
[PROOF STEP]
unfolding ids_def
[PROOF STATE]
proof (prove)
using this:
Name n |\<in>| frees (Sabs cs)
Name n |\<notin>| frees (Sabs cs) |\<union>| consts (Sabs cs)
goal (1 subgoal):
1. False
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
False
goal (1 subgoal):
1. \<lbrakk>Name n |\<notin>| frees rhs; Name n |\<in>| consts rhs\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<lbrakk>Name n |\<notin>| frees rhs; Name n |\<in>| consts rhs\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
case B
[PROOF STATE]
proof (state)
this:
Name n |\<notin>| frees rhs
Name n |\<in>| consts rhs
goal (1 subgoal):
1. \<lbrakk>Name n |\<notin>| frees rhs; Name n |\<in>| consts rhs\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
hence "Name n |\<in>| consts (Sabs cs)"
[PROOF STATE]
proof (prove)
using this:
Name n |\<notin>| frees rhs
Name n |\<in>| consts rhs
goal (1 subgoal):
1. Name n |\<in>| consts (Sabs cs)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>Name n |\<notin>| frees rhs; Name n |\<in>| consts rhs\<rbrakk> \<Longrightarrow> Name n |\<in>| ffUnion ((\<lambda>(uu_, y). consts y) |`| fset_of_list cs)
[PROOF STEP]
unfolding ffUnion_alt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>Name n |\<notin>| frees rhs; Name n |\<in>| consts rhs\<rbrakk> \<Longrightarrow> fBex ((\<lambda>(uu_, y). consts y) |`| fset_of_list cs) ((|\<in>|) (Name n))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>Name n |\<notin>| frees rhs; Name n |\<in>| consts rhs\<rbrakk> \<Longrightarrow> fBex (fset_of_list cs) (\<lambda>x. Name n |\<in>| (case x of (uu_, x) \<Rightarrow> consts x))
[PROOF STEP]
apply (rule fBexI[where x = "(pat, rhs)"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<lbrakk>Name n |\<notin>| frees rhs; Name n |\<in>| consts rhs\<rbrakk> \<Longrightarrow> Name n |\<in>| (case (pat, rhs) of (uu_, x) \<Rightarrow> consts x)
2. \<lbrakk>Name n |\<notin>| frees rhs; Name n |\<in>| consts rhs\<rbrakk> \<Longrightarrow> (pat, rhs) |\<in>| fset_of_list cs
[PROOF STEP]
apply (auto simp: fset_of_list_elem)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>Name n |\<notin>| frees rhs; Name n |\<in>| consts rhs\<rbrakk> \<Longrightarrow> (pat, rhs) \<in> set cs
[PROOF STEP]
apply (rule \<open>(pat, rhs) \<in> set cs\<close>)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
Name n |\<in>| consts (Sabs cs)
goal (1 subgoal):
1. \<lbrakk>Name n |\<notin>| frees rhs; Name n |\<in>| consts rhs\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Name n |\<in>| consts (Sabs cs)
goal (1 subgoal):
1. False
[PROOF STEP]
using \<open>Name n |\<notin>| ids (Sabs cs)\<close>
[PROOF STATE]
proof (prove)
using this:
Name n |\<in>| consts (Sabs cs)
Name n |\<notin>| ids (Sabs cs)
goal (1 subgoal):
1. False
[PROOF STEP]
unfolding ids_def
[PROOF STATE]
proof (prove)
using this:
Name n |\<in>| consts (Sabs cs)
Name n |\<notin>| frees (Sabs cs) |\<union>| consts (Sabs cs)
goal (1 subgoal):
1. False
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
False
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
False
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Name n |\<notin>| fmdom env \<Longrightarrow> Name n |\<notin>| ids rhs
goal (11 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmrel_on_fset (ids rhs) erelated ?\<Gamma>'6 (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
5. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
6. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
7. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env) |\<union>| C
8. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
9. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
10. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
A total of 11 subgoals...
[PROOF STEP]
show "fmrel_on_fset (ids rhs) erelated (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env) (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmrel_on_fset (ids rhs) erelated (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env) (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<And>x. x |\<in>| ids rhs \<Longrightarrow> rel_option erelated (fmlookup (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env) x) (fmlookup (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env) x)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (8 subgoals):
1. \<lbrakk>Name n |\<in>| ids rhs; Name n |\<in>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n |\<in>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup env (Name n)) (fmlookup env (Name n))
2. \<lbrakk>Name n |\<in>| ids rhs; Name n |\<in>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n |\<notin>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup (mk_rec_env css \<Gamma>\<^sub>\<Lambda>) (Name n)) (Some v\<^sub>2)
3. \<And>x. \<lbrakk>x |\<in>| ids rhs; x |\<in>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n \<noteq> x; x |\<in>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup env x) (fmlookup env x)
4. \<And>x. \<lbrakk>x |\<in>| ids rhs; x |\<in>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n \<noteq> x; x |\<notin>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup (mk_rec_env css \<Gamma>\<^sub>\<Lambda>) x) (fmlookup (mk_rec_env css \<Gamma>\<^sub>\<Lambda>) x)
5. \<lbrakk>Name n |\<in>| ids rhs; Name n |\<notin>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n |\<in>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup env (Name n)) (fmlookup env (Name n))
6. \<lbrakk>Name n |\<in>| ids rhs; Name n |\<notin>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n |\<notin>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup \<Gamma>\<^sub>\<Lambda> (Name n)) (Some v\<^sub>2)
7. \<And>x. \<lbrakk>x |\<in>| ids rhs; x |\<notin>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n \<noteq> x; x |\<in>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup env x) (fmlookup env x)
8. \<And>x. \<lbrakk>x |\<in>| ids rhs; x |\<notin>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n \<noteq> x; x |\<notin>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup \<Gamma>\<^sub>\<Lambda> x) (fmlookup \<Gamma>\<^sub>\<Lambda> x)
[PROOF STEP]
apply (rule option.rel_refl; rule erelated_refl)
[PROOF STATE]
proof (prove)
goal (7 subgoals):
1. \<lbrakk>Name n |\<in>| ids rhs; Name n |\<in>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n |\<notin>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup (mk_rec_env css \<Gamma>\<^sub>\<Lambda>) (Name n)) (Some v\<^sub>2)
2. \<And>x. \<lbrakk>x |\<in>| ids rhs; x |\<in>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n \<noteq> x; x |\<in>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup env x) (fmlookup env x)
3. \<And>x. \<lbrakk>x |\<in>| ids rhs; x |\<in>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n \<noteq> x; x |\<notin>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup (mk_rec_env css \<Gamma>\<^sub>\<Lambda>) x) (fmlookup (mk_rec_env css \<Gamma>\<^sub>\<Lambda>) x)
4. \<lbrakk>Name n |\<in>| ids rhs; Name n |\<notin>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n |\<in>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup env (Name n)) (fmlookup env (Name n))
5. \<lbrakk>Name n |\<in>| ids rhs; Name n |\<notin>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n |\<notin>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup \<Gamma>\<^sub>\<Lambda> (Name n)) (Some v\<^sub>2)
6. \<And>x. \<lbrakk>x |\<in>| ids rhs; x |\<notin>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n \<noteq> x; x |\<in>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup env x) (fmlookup env x)
7. \<And>x. \<lbrakk>x |\<in>| ids rhs; x |\<notin>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n \<noteq> x; x |\<notin>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup \<Gamma>\<^sub>\<Lambda> x) (fmlookup \<Gamma>\<^sub>\<Lambda> x)
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
Name n |\<notin>| fmdom env \<Longrightarrow> Name n |\<notin>| ids rhs
goal (7 subgoals):
1. \<lbrakk>Name n |\<in>| ids rhs; Name n |\<in>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n |\<notin>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup (mk_rec_env css \<Gamma>\<^sub>\<Lambda>) (Name n)) (Some v\<^sub>2)
2. \<And>x. \<lbrakk>x |\<in>| ids rhs; x |\<in>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n \<noteq> x; x |\<in>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup env x) (fmlookup env x)
3. \<And>x. \<lbrakk>x |\<in>| ids rhs; x |\<in>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n \<noteq> x; x |\<notin>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup (mk_rec_env css \<Gamma>\<^sub>\<Lambda>) x) (fmlookup (mk_rec_env css \<Gamma>\<^sub>\<Lambda>) x)
4. \<lbrakk>Name n |\<in>| ids rhs; Name n |\<notin>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n |\<in>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup env (Name n)) (fmlookup env (Name n))
5. \<lbrakk>Name n |\<in>| ids rhs; Name n |\<notin>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n |\<notin>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup \<Gamma>\<^sub>\<Lambda> (Name n)) (Some v\<^sub>2)
6. \<And>x. \<lbrakk>x |\<in>| ids rhs; x |\<notin>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n \<noteq> x; x |\<in>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup env x) (fmlookup env x)
7. \<And>x. \<lbrakk>x |\<in>| ids rhs; x |\<notin>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n \<noteq> x; x |\<notin>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup \<Gamma>\<^sub>\<Lambda> x) (fmlookup \<Gamma>\<^sub>\<Lambda> x)
[PROOF STEP]
apply auto[]
[PROOF STATE]
proof (prove)
goal (6 subgoals):
1. \<And>x. \<lbrakk>x |\<in>| ids rhs; x |\<in>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n \<noteq> x; x |\<in>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup env x) (fmlookup env x)
2. \<And>x. \<lbrakk>x |\<in>| ids rhs; x |\<in>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n \<noteq> x; x |\<notin>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup (mk_rec_env css \<Gamma>\<^sub>\<Lambda>) x) (fmlookup (mk_rec_env css \<Gamma>\<^sub>\<Lambda>) x)
3. \<lbrakk>Name n |\<in>| ids rhs; Name n |\<notin>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n |\<in>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup env (Name n)) (fmlookup env (Name n))
4. \<lbrakk>Name n |\<in>| ids rhs; Name n |\<notin>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n |\<notin>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup \<Gamma>\<^sub>\<Lambda> (Name n)) (Some v\<^sub>2)
5. \<And>x. \<lbrakk>x |\<in>| ids rhs; x |\<notin>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n \<noteq> x; x |\<in>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup env x) (fmlookup env x)
6. \<And>x. \<lbrakk>x |\<in>| ids rhs; x |\<notin>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n \<noteq> x; x |\<notin>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup \<Gamma>\<^sub>\<Lambda> x) (fmlookup \<Gamma>\<^sub>\<Lambda> x)
[PROOF STEP]
apply (rule option.rel_refl; rule erelated_refl)+
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. \<lbrakk>Name n |\<in>| ids rhs; Name n |\<notin>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n |\<notin>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup \<Gamma>\<^sub>\<Lambda> (Name n)) (Some v\<^sub>2)
2. \<And>x. \<lbrakk>x |\<in>| ids rhs; x |\<notin>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n \<noteq> x; x |\<in>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup env x) (fmlookup env x)
3. \<And>x. \<lbrakk>x |\<in>| ids rhs; x |\<notin>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n \<noteq> x; x |\<notin>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup \<Gamma>\<^sub>\<Lambda> x) (fmlookup \<Gamma>\<^sub>\<Lambda> x)
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
Name n |\<notin>| fmdom env \<Longrightarrow> Name n |\<notin>| ids rhs
goal (3 subgoals):
1. \<lbrakk>Name n |\<in>| ids rhs; Name n |\<notin>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n |\<notin>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup \<Gamma>\<^sub>\<Lambda> (Name n)) (Some v\<^sub>2)
2. \<And>x. \<lbrakk>x |\<in>| ids rhs; x |\<notin>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n \<noteq> x; x |\<in>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup env x) (fmlookup env x)
3. \<And>x. \<lbrakk>x |\<in>| ids rhs; x |\<notin>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n \<noteq> x; x |\<notin>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup \<Gamma>\<^sub>\<Lambda> x) (fmlookup \<Gamma>\<^sub>\<Lambda> x)
[PROOF STEP]
apply auto[]
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<And>x. \<lbrakk>x |\<in>| ids rhs; x |\<notin>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n \<noteq> x; x |\<in>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup env x) (fmlookup env x)
2. \<And>x. \<lbrakk>x |\<in>| ids rhs; x |\<notin>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>); Name n \<noteq> x; x |\<notin>| fmdom env\<rbrakk> \<Longrightarrow> rel_option erelated (fmlookup \<Gamma>\<^sub>\<Lambda> x) (fmlookup \<Gamma>\<^sub>\<Lambda> x)
[PROOF STEP]
apply (rule option.rel_refl; rule erelated_refl)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
fmrel_on_fset (ids rhs) erelated (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env) (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
goal (10 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
5. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
6. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env) |\<union>| C
7. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
8. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
9. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
10. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (10 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
5. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
6. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env) |\<union>| C
7. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
8. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
9. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
10. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show "closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
2. closed_venv env
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. closed_venv env
[PROOF STEP]
apply (rule vclosed.vmatch_env)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. vmatch ?pat4 ?v4 = Some env
2. vclosed ?v4
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. vclosed v\<^sub>2
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
closed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
goal (9 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
5. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env) |\<union>| C
6. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
7. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
8. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
9. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (9 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
5. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env) |\<union>| C
6. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
7. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
8. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
9. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show "wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
2. wellformed_venv env
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. wellformed_venv env
[PROOF STEP]
apply (rule vwellformed.vmatch_env)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. vmatch ?pat4 ?v4 = Some env
2. vwellformed ?v4
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. vwellformed v\<^sub>2
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
wellformed_venv (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
goal (8 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env) |\<union>| C
5. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
6. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
7. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
8. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (8 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env) |\<union>| C
5. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
6. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
7. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
8. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show "closed_except rhs (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. closed_except rhs (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
[PROOF STEP]
using \<open>fmdom env = frees pat\<close> \<open>(pat, rhs) \<in> set cs\<close>
[PROOF STATE]
proof (prove)
using this:
fmdom env = frees pat
(pat, rhs) \<in> set cs
goal (1 subgoal):
1. closed_except rhs (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
[PROOF STEP]
using \<open>closed_except (Sabs cs) (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))\<close>
[PROOF STATE]
proof (prove)
using this:
fmdom env = frees pat
(pat, rhs) \<in> set cs
closed_except (Sabs cs) (fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>))
goal (1 subgoal):
1. closed_except rhs (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
[PROOF STEP]
apply (auto simp: Sterm.closed_except_simps list_all_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>fmdom env = frees pat; (pat, rhs) \<in> set cs; \<forall>x\<in>set cs. case x of (pat, t) \<Rightarrow> closed_except t (finsert (Name n) (fmdom \<Gamma>\<^sub>\<Lambda> |\<union>| frees pat))\<rbrakk> \<Longrightarrow> closed_except rhs (finsert (Name n) (fmdom \<Gamma>\<^sub>\<Lambda> |\<union>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>) |\<union>| frees pat))
[PROOF STEP]
apply (erule ballE[where x = "(pat, rhs)"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<lbrakk>fmdom env = frees pat; (pat, rhs) \<in> set cs; case (pat, rhs) of (pat, t) \<Rightarrow> closed_except t (finsert (Name n) (fmdom \<Gamma>\<^sub>\<Lambda> |\<union>| frees pat))\<rbrakk> \<Longrightarrow> closed_except rhs (finsert (Name n) (fmdom \<Gamma>\<^sub>\<Lambda> |\<union>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>) |\<union>| frees pat))
2. \<lbrakk>fmdom env = frees pat; (pat, rhs) \<in> set cs; (pat, rhs) \<notin> set cs\<rbrakk> \<Longrightarrow> closed_except rhs (finsert (Name n) (fmdom \<Gamma>\<^sub>\<Lambda> |\<union>| fmdom (mk_rec_env css \<Gamma>\<^sub>\<Lambda>) |\<union>| frees pat))
[PROOF STEP]
apply (auto simp: closed_except_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
closed_except rhs (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
goal (7 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env) |\<union>| C
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
5. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
6. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
7. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (7 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env) |\<union>| C
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
5. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
6. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
7. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show "wellformed rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. pre_strong_term_class.wellformed rhs
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
pre_strong_term_class.wellformed rhs
goal (6 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env) |\<union>| C
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
5. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
6. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (6 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env) |\<union>| C
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
5. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
6. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show "consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env) |\<union>| C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env) |\<union>| C
[PROOF STEP]
using \<open>consts (Sabs cs) |\<subseteq>| _\<close> \<open>(pat, rhs) \<in> set cs\<close>
[PROOF STATE]
proof (prove)
using this:
consts (Sabs cs) |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| (C |\<union>| fmdom css)
(pat, rhs) \<in> set cs
goal (1 subgoal):
1. consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env) |\<union>| C
[PROOF STEP]
unfolding sconsts_sabs mk_rec_env_def
[PROOF STATE]
proof (prove)
using this:
list_all (\<lambda>(uu_, t). consts t |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 \<Gamma>\<^sub>\<Lambda>) |\<union>| (C |\<union>| fmdom css)) cs
(pat, rhs) \<in> set cs
goal (1 subgoal):
1. consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f fmmap_keys (\<lambda>name cs. Vrecabs css name \<Gamma>\<^sub>\<Lambda>) css) ++\<^sub>f env) |\<union>| C
[PROOF STEP]
by (auto simp: list_all_iff)
[PROOF STATE]
proof (state)
this:
consts rhs |\<subseteq>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env) |\<union>| C
goal (5 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
5. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (5 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
5. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have "fdisjnt C (fmdom env)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fdisjnt C (fmdom env)
[PROOF STEP]
using \<open>(pat, rhs) \<in> set cs\<close> \<open>\<not> shadows_consts (Sabs cs)\<close>
[PROOF STATE]
proof (prove)
using this:
(pat, rhs) \<in> set cs
\<not> shadows_consts (Sabs cs)
goal (1 subgoal):
1. fdisjnt C (fmdom env)
[PROOF STEP]
unfolding \<open>fmdom env = frees pat\<close>
[PROOF STATE]
proof (prove)
using this:
(pat, rhs) \<in> set cs
\<not> shadows_consts (Sabs cs)
goal (1 subgoal):
1. fdisjnt C (frees pat)
[PROOF STEP]
by (auto simp: list_ex_iff all_consts_def fdisjnt_alt_def)
[PROOF STATE]
proof (state)
this:
fdisjnt C (fmdom env)
goal (5 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
5. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
fdisjnt C (fmdom env)
goal (5 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
5. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have "fdisjnt C (fmdom css)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fdisjnt C (fmdom css)
[PROOF STEP]
using \<open>vwelldefined' v\<^sub>1\<close>
[PROOF STATE]
proof (prove)
using this:
vwelldefined' v\<^sub>1
goal (1 subgoal):
1. fdisjnt C (fmdom css)
[PROOF STEP]
unfolding \<open>v\<^sub>1 = _\<close>
[PROOF STATE]
proof (prove)
using this:
vwelldefined' (Vrecabs css (Name name) \<Gamma>\<^sub>\<Lambda>)
goal (1 subgoal):
1. fdisjnt C (fmdom css)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fdisjnt C (fmdom css)
goal (5 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
4. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
5. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
fdisjnt C (fmdom env)
fdisjnt C (fmdom css)
[PROOF STEP]
show "fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))"
[PROOF STATE]
proof (prove)
using this:
fdisjnt C (fmdom env)
fdisjnt C (fmdom css)
goal (1 subgoal):
1. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
[PROOF STEP]
using \<open>Name n |\<notin>| all_consts\<close> \<open>fdisjnt C (fmdom \<Gamma>\<^sub>\<Lambda>)\<close>
[PROOF STATE]
proof (prove)
using this:
fdisjnt C (fmdom env)
fdisjnt C (fmdom css)
Name n |\<notin>| all_consts
fdisjnt C (fmdom \<Gamma>\<^sub>\<Lambda>)
goal (1 subgoal):
1. fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
[PROOF STEP]
unfolding fdisjnt_alt_def mk_rec_env_def
[PROOF STATE]
proof (prove)
using this:
C |\<inter>| fmdom env = {||}
C |\<inter>| fmdom css = {||}
Name n |\<notin>| all_consts
C |\<inter>| fmdom \<Gamma>\<^sub>\<Lambda> = {||}
goal (1 subgoal):
1. C |\<inter>| fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f fmmap_keys (\<lambda>name cs. Vrecabs css name \<Gamma>\<^sub>\<Lambda>) css) ++\<^sub>f env) = {||}
[PROOF STEP]
by (auto simp: all_consts_def)
[PROOF STATE]
proof (state)
this:
fdisjnt C (fmdom (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env))
goal (4 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
4. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (4 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
3. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
4. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show "\<not> shadows_consts rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<not> shadows_consts rhs
[PROOF STEP]
using \<open>(pat, rhs) \<in> set cs\<close> \<open>\<not> shadows_consts (Sabs cs)\<close>
[PROOF STATE]
proof (prove)
using this:
(pat, rhs) \<in> set cs
\<not> shadows_consts (Sabs cs)
goal (1 subgoal):
1. \<not> shadows_consts rhs
[PROOF STEP]
by (auto simp: list_ex_iff)
[PROOF STATE]
proof (state)
this:
\<not> shadows_consts rhs
goal (3 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
3. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
3. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have "not_shadows_vconsts_env env"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. not_shadows_vconsts_env env
[PROOF STEP]
by (rule not_shadows_vconsts.vmatch_env) fact+
[PROOF STATE]
proof (state)
this:
not_shadows_vconsts_env env
goal (3 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
2. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
3. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
thus "not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)"
[PROOF STATE]
proof (prove)
using this:
not_shadows_vconsts_env env
goal (1 subgoal):
1. not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
[PROOF STEP]
using \<open>not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))\<close>
[PROOF STATE]
proof (prove)
using this:
not_shadows_vconsts_env env
not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
goal (1 subgoal):
1. not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
not_shadows_vconsts_env (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
goal (2 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
2. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
2. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have "fmpred (\<lambda>_. vwelldefined') env"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmpred (\<lambda>_. vwelldefined') env
[PROOF STEP]
by (rule vmatch_welldefined') fact+
[PROOF STATE]
proof (state)
this:
fmpred (\<lambda>_. vwelldefined') env
goal (2 subgoals):
1. (\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
2. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
thus "fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)"
[PROOF STATE]
proof (prove)
using this:
fmpred (\<lambda>_. vwelldefined') env
goal (1 subgoal):
1. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
[PROOF STEP]
using \<open>fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))\<close>
[PROOF STATE]
proof (prove)
using this:
fmpred (\<lambda>_. vwelldefined') env
fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>))
goal (1 subgoal):
1. fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
fmpred (\<lambda>_. vwelldefined') (fmupd (Name n) v\<^sub>2 (\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda>) ++\<^sub>f env)
goal (1 subgoal):
1. \<And>v'. \<lbrakk>\<And>v'. \<lbrakk>\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis; \<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'; v' \<approx>\<^sub>e v\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
qed simp
[PROOF STATE]
proof (state)
this:
\<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f env \<turnstile>\<^sub>v rhs \<down> v'
v' \<approx>\<^sub>e v
goal (1 subgoal):
1. \<And>env funs name n v0. \<lbrakk>rev ml_vs = [Recclosure env funs name, v0]; allDistinct (map (\<lambda>(f, uu_, uu_). f) funs); find_recfun name funs = Some (n, exp'); env' = update_v (\<lambda>_. nsBind n v0 (build_rec_env funs env (sem_env.v env))) env\<rbrakk> \<Longrightarrow> \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
[PROOF STEP]
apply (intro exI conjI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<Gamma> \<turnstile>\<^sub>v t \<down> ?v
2. related_v ?v ml_v
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<Gamma> \<turnstile>\<^sub>v t\<^sub>1 $\<^sub>s t\<^sub>2 \<down> ?v
2. related_v ?v ml_v
[PROOF STEP]
apply (rule veval'.rec_comb)
[PROOF STATE]
proof (prove)
goal (6 subgoals):
1. \<Gamma> \<turnstile>\<^sub>v t\<^sub>1 \<down> Vrecabs ?css2 ?name2 ?\<Gamma>'2
2. fmlookup ?css2 ?name2 = Some ?cs2
3. \<Gamma> \<turnstile>\<^sub>v t\<^sub>2 \<down> ?u'2
4. vfind_match ?cs2 ?u'2 = Some (?env2, ?uv2, ?rhs2)
5. ?\<Gamma>'2 ++\<^sub>f mk_rec_env ?css2 ?\<Gamma>'2 ++\<^sub>f ?env2 \<turnstile>\<^sub>v ?rhs2 \<down> ?v
6. related_v ?v ml_v
[PROOF STEP]
using \<open>\<Gamma> \<turnstile>\<^sub>v t\<^sub>1 \<down> v\<^sub>1\<close>
[PROOF STATE]
proof (prove)
using this:
\<Gamma> \<turnstile>\<^sub>v t\<^sub>1 \<down> v\<^sub>1
goal (6 subgoals):
1. \<Gamma> \<turnstile>\<^sub>v t\<^sub>1 \<down> Vrecabs ?css2 ?name2 ?\<Gamma>'2
2. fmlookup ?css2 ?name2 = Some ?cs2
3. \<Gamma> \<turnstile>\<^sub>v t\<^sub>2 \<down> ?u'2
4. vfind_match ?cs2 ?u'2 = Some (?env2, ?uv2, ?rhs2)
5. ?\<Gamma>'2 ++\<^sub>f mk_rec_env ?css2 ?\<Gamma>'2 ++\<^sub>f ?env2 \<turnstile>\<^sub>v ?rhs2 \<down> ?v
6. related_v ?v ml_v
[PROOF STEP]
unfolding \<open>v\<^sub>1 = _\<close>
[PROOF STATE]
proof (prove)
using this:
\<Gamma> \<turnstile>\<^sub>v t\<^sub>1 \<down> Vrecabs css (Name name) \<Gamma>\<^sub>\<Lambda>
goal (6 subgoals):
1. \<Gamma> \<turnstile>\<^sub>v t\<^sub>1 \<down> Vrecabs ?css2 ?name2 ?\<Gamma>'2
2. fmlookup ?css2 ?name2 = Some ?cs2
3. \<Gamma> \<turnstile>\<^sub>v t\<^sub>2 \<down> ?u'2
4. vfind_match ?cs2 ?u'2 = Some (?env2, ?uv2, ?rhs2)
5. ?\<Gamma>'2 ++\<^sub>f mk_rec_env ?css2 ?\<Gamma>'2 ++\<^sub>f ?env2 \<turnstile>\<^sub>v ?rhs2 \<down> ?v
6. related_v ?v ml_v
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (5 subgoals):
1. fmlookup css (Name name) = Some ?cs2
2. \<Gamma> \<turnstile>\<^sub>v t\<^sub>2 \<down> ?u'2
3. vfind_match ?cs2 ?u'2 = Some (?env2, ?uv2, ?rhs2)
4. \<Gamma>\<^sub>\<Lambda> ++\<^sub>f mk_rec_env css \<Gamma>\<^sub>\<Lambda> ++\<^sub>f ?env2 \<turnstile>\<^sub>v ?rhs2 \<down> ?v
5. related_v ?v ml_v
[PROOF STEP]
apply fact+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. related_v v' ml_v
[PROOF STEP]
apply (rule related_v_ext)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. related_v ?v15 ml_v
2. v' \<approx>\<^sub>e ?v15
[PROOF STEP]
apply fact+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
\<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
goal (8 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
5. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
6. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
7. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
8. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (8 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
5. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
6. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
7. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
8. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
case (mat1 env ml_scr ml_scr' ml_cs ml_rhs ml_pat env' ml_res)
[PROOF STATE]
proof (state)
this:
cupcake_evaluate_single env ml_scr (Rval ml_scr')
cupcake_match_result (sem_env.c env) ml_scr' ml_cs Bindv = Rval (ml_rhs, ml_pat, env')
cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) ml_rhs ml_res
\<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env)); related_exp ?t4 ml_scr; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) (Rval ml_scr')
\<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp ?t4 ml_rhs; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) ml_res
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (Mat ml_scr ml_cs)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
goal (8 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
5. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
6. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
7. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
8. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
obtain scr cs
where "t = Sabs cs $\<^sub>s scr" "related_exp scr ml_scr"
and "list_all2 (rel_prod related_pat related_exp) cs ml_cs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<And>cs scr. \<lbrakk>t = Sabs cs $\<^sub>s scr; related_exp scr ml_scr; list_all2 (rel_prod related_pat related_exp) cs ml_cs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>related_exp t (Mat ml_scr ml_cs)\<close>
[PROOF STATE]
proof (prove)
using this:
related_exp t (Mat ml_scr ml_cs)
goal (1 subgoal):
1. (\<And>cs scr. \<lbrakk>t = Sabs cs $\<^sub>s scr; related_exp scr ml_scr; list_all2 (rel_prod related_pat related_exp) cs ml_cs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by cases
[PROOF STATE]
proof (state)
this:
t = Sabs cs $\<^sub>s scr
related_exp scr ml_scr
list_all2 (rel_prod related_pat related_exp) cs ml_cs
goal (8 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
5. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
6. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
7. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
8. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
have "sem_env.c env = as_static_cenv"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. sem_env.c env = as_static_cenv
[PROOF STEP]
using \<open>is_cupcake_all_env env\<close>
[PROOF STATE]
proof (prove)
using this:
is_cupcake_all_env env
goal (1 subgoal):
1. sem_env.c env = as_static_cenv
[PROOF STEP]
by (auto elim: is_cupcake_all_envE)
[PROOF STATE]
proof (state)
this:
sem_env.c env = as_static_cenv
goal (8 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
5. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
6. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
7. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
8. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
obtain scr' where "\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'" "related_v scr' ml_scr'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using mat1(4)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env)); related_exp ?t4 ml_scr; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) (Rval ml_scr')
goal (1 subgoal):
1. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding if_rval.simps
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env)); related_exp ?t4 ml_scr; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_scr'
goal (1 subgoal):
1. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (13 subgoals):
1. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> is_cupcake_all_env env
2. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmrel_on_fset (ids ?t11) related_v ?\<Gamma>11 (fmap_of_ns (sem_env.v env))
3. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> related_exp ?t11 ml_scr
4. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed ?t11
5. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> wellformed_venv ?\<Gamma>11
6. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_venv ?\<Gamma>11
7. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except ?t11 (fmdom ?\<Gamma>11)
8. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') ?\<Gamma>11
9. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts ?t11 |\<subseteq>| fmdom ?\<Gamma>11 |\<union>| C
10. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom ?\<Gamma>11)
A total of 13 subgoals...
[PROOF STEP]
show
"is_cupcake_all_env env" "related_exp scr ml_scr" "wellformed_venv \<Gamma>"
"closed_venv \<Gamma>" "fmpred (\<lambda>_. vwelldefined') \<Gamma>" "fdisjnt C (fmdom \<Gamma>)"
"not_shadows_vconsts_env \<Gamma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (is_cupcake_all_env env &&& related_exp scr ml_scr &&& wellformed_venv \<Gamma>) &&& (closed_venv \<Gamma> &&& fmpred (\<lambda>_. vwelldefined') \<Gamma>) &&& fdisjnt C (fmdom \<Gamma>) &&& not_shadows_vconsts_env \<Gamma>
[PROOF STEP]
by fact+
[PROOF STATE]
proof (state)
this:
is_cupcake_all_env env
related_exp scr ml_scr
wellformed_venv \<Gamma>
closed_venv \<Gamma>
fmpred (\<lambda>_. vwelldefined') \<Gamma>
fdisjnt C (fmdom \<Gamma>)
not_shadows_vconsts_env \<Gamma>
goal (6 subgoals):
1. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmrel_on_fset (ids scr) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
2. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed scr
3. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except scr (fmdom \<Gamma>)
4. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts scr |\<subseteq>| fmdom \<Gamma> |\<union>| C
5. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts scr
6. \<And>x. \<lbrakk>\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis; \<Gamma> \<turnstile>\<^sub>v scr \<down> x \<and> related_v x ml_scr'\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (6 subgoals):
1. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmrel_on_fset (ids scr) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
2. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed scr
3. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except scr (fmdom \<Gamma>)
4. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts scr |\<subseteq>| fmdom \<Gamma> |\<union>| C
5. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts scr
6. \<And>x. \<lbrakk>\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis; \<Gamma> \<turnstile>\<^sub>v scr \<down> x \<and> related_v x ml_scr'\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show "fmrel_on_fset (ids scr) related_v \<Gamma> (fmap_of_ns (sem_env.v env))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmrel_on_fset (ids scr) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
[PROOF STEP]
apply (rule fmrel_on_fsubset)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. fmrel_on_fset ?S related_v \<Gamma> (fmap_of_ns (sem_env.v env))
2. ids scr |\<subseteq>| ?S
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. ids scr |\<subseteq>| ids t
[PROOF STEP]
unfolding \<open>t = _\<close> ids_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. frees scr |\<union>| consts scr |\<subseteq>| frees (Sabs cs $\<^sub>s scr) |\<union>| consts (Sabs cs $\<^sub>s scr)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
fmrel_on_fset (ids scr) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
goal (5 subgoals):
1. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed scr
2. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except scr (fmdom \<Gamma>)
3. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts scr |\<subseteq>| fmdom \<Gamma> |\<union>| C
4. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts scr
5. \<And>x. \<lbrakk>\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis; \<Gamma> \<turnstile>\<^sub>v scr \<down> x \<and> related_v x ml_scr'\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (5 subgoals):
1. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed scr
2. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except scr (fmdom \<Gamma>)
3. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts scr |\<subseteq>| fmdom \<Gamma> |\<union>| C
4. (\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts scr
5. \<And>x. \<lbrakk>\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis; \<Gamma> \<turnstile>\<^sub>v scr \<down> x \<and> related_v x ml_scr'\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show
"wellformed scr" "consts scr |\<subseteq>| fmdom \<Gamma> |\<union>| C"
"closed_except scr (fmdom \<Gamma>)" "\<not> shadows_consts scr"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (pre_strong_term_class.wellformed scr &&& consts scr |\<subseteq>| fmdom \<Gamma> |\<union>| C) &&& closed_except scr (fmdom \<Gamma>) &&& \<not> shadows_consts scr
[PROOF STEP]
using mat1
[PROOF STATE]
proof (prove)
using this:
cupcake_evaluate_single env ml_scr (Rval ml_scr')
cupcake_match_result (sem_env.c env) ml_scr' ml_cs Bindv = Rval (ml_rhs, ml_pat, env')
cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) ml_rhs ml_res
\<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env)); related_exp ?t4 ml_scr; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) (Rval ml_scr')
\<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp ?t4 ml_rhs; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) ml_res
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (Mat ml_scr ml_cs)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
goal (1 subgoal):
1. (pre_strong_term_class.wellformed scr &&& consts scr |\<subseteq>| fmdom \<Gamma> |\<union>| C) &&& closed_except scr (fmdom \<Gamma>) &&& \<not> shadows_consts scr
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
using this:
cupcake_evaluate_single env ml_scr (Rval ml_scr')
cupcake_match_result (sem_env.c env) ml_scr' ml_cs Bindv = Rval (ml_rhs, ml_pat, env')
cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) ml_rhs ml_res
\<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env)); related_exp ?t4 ml_scr; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) (Rval ml_scr')
\<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp ?t4 ml_rhs; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) ml_res
is_cupcake_all_env env
fmrel_on_fset (ids (Sabs cs $\<^sub>s scr)) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp (Sabs cs $\<^sub>s scr) (Mat ml_scr ml_cs)
pre_strong_term_class.wellformed (Sabs cs $\<^sub>s scr)
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except (Sabs cs $\<^sub>s scr) (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts (Sabs cs $\<^sub>s scr) |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts (Sabs cs $\<^sub>s scr)
not_shadows_vconsts_env \<Gamma>
goal (1 subgoal):
1. (pre_strong_term_class.wellformed scr &&& consts scr |\<subseteq>| fmdom \<Gamma> |\<union>| C) &&& closed_except scr (fmdom \<Gamma>) &&& \<not> shadows_consts scr
[PROOF STEP]
by (auto simp: closed_except_def)
[PROOF STATE]
proof (state)
this:
pre_strong_term_class.wellformed scr
consts scr |\<subseteq>| fmdom \<Gamma> |\<union>| C
closed_except scr (fmdom \<Gamma>)
\<not> shadows_consts scr
goal (1 subgoal):
1. \<And>x. \<lbrakk>\<And>scr'. \<lbrakk>\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'; related_v scr' ml_scr'\<rbrakk> \<Longrightarrow> thesis; \<Gamma> \<turnstile>\<^sub>v scr \<down> x \<and> related_v x ml_scr'\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
qed blast
[PROOF STATE]
proof (state)
this:
\<Gamma> \<turnstile>\<^sub>v scr \<down> scr'
related_v scr' ml_scr'
goal (8 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
5. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
6. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
7. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
8. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
have "list_all (\<lambda>(pat, _). linear pat) cs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. list_all (\<lambda>(pat, uu_). Pats.linear pat) cs
[PROOF STEP]
using mat1
[PROOF STATE]
proof (prove)
using this:
cupcake_evaluate_single env ml_scr (Rval ml_scr')
cupcake_match_result (sem_env.c env) ml_scr' ml_cs Bindv = Rval (ml_rhs, ml_pat, env')
cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) ml_rhs ml_res
\<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env)); related_exp ?t4 ml_scr; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) (Rval ml_scr')
\<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp ?t4 ml_rhs; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) ml_res
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (Mat ml_scr ml_cs)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
goal (1 subgoal):
1. list_all (\<lambda>(pat, uu_). Pats.linear pat) cs
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
using this:
cupcake_evaluate_single env ml_scr (Rval ml_scr')
cupcake_match_result (sem_env.c env) ml_scr' ml_cs Bindv = Rval (ml_rhs, ml_pat, env')
cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) ml_rhs ml_res
\<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env)); related_exp ?t4 ml_scr; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) (Rval ml_scr')
\<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp ?t4 ml_rhs; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) ml_res
is_cupcake_all_env env
fmrel_on_fset (ids (Sabs cs $\<^sub>s scr)) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp (Sabs cs $\<^sub>s scr) (Mat ml_scr ml_cs)
pre_strong_term_class.wellformed (Sabs cs $\<^sub>s scr)
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except (Sabs cs $\<^sub>s scr) (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts (Sabs cs $\<^sub>s scr) |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts (Sabs cs $\<^sub>s scr)
not_shadows_vconsts_env \<Gamma>
goal (1 subgoal):
1. list_all (\<lambda>(pat, uu_). Pats.linear pat) cs
[PROOF STEP]
by (auto simp: list_all_iff)
[PROOF STATE]
proof (state)
this:
list_all (\<lambda>(pat, uu_). Pats.linear pat) cs
goal (8 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
5. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
6. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
7. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
8. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
obtain rhs pat \<Gamma>'
where "ml_pat = mk_ml_pat (mk_pat pat)" "related_exp rhs ml_rhs"
and "vfind_match cs scr' = Some (\<Gamma>', pat, rhs)"
and "var_env \<Gamma>' env'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<And>pat rhs \<Gamma>'. \<lbrakk>related_pat pat ml_pat; related_exp rhs ml_rhs; vfind_match cs scr' = Some (\<Gamma>', pat, rhs); var_env \<Gamma>' env'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>list_all2 _ cs ml_cs\<close> \<open>list_all _ cs\<close> \<open>related_v scr' ml_scr'\<close> mat1(2)
[PROOF STATE]
proof (prove)
using this:
list_all2 (rel_prod related_pat related_exp) cs ml_cs
list_all (\<lambda>(pat, uu_). Pats.linear pat) cs
related_v scr' ml_scr'
cupcake_match_result (sem_env.c env) ml_scr' ml_cs Bindv = Rval (ml_rhs, ml_pat, env')
goal (1 subgoal):
1. (\<And>pat rhs \<Gamma>'. \<lbrakk>related_pat pat ml_pat; related_exp rhs ml_rhs; vfind_match cs scr' = Some (\<Gamma>', pat, rhs); var_env \<Gamma>' env'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding \<open>sem_env.c env = as_static_cenv\<close>
[PROOF STATE]
proof (prove)
using this:
list_all2 (rel_prod related_pat related_exp) cs ml_cs
list_all (\<lambda>(pat, uu_). Pats.linear pat) cs
related_v scr' ml_scr'
cupcake_match_result as_static_cenv ml_scr' ml_cs Bindv = Rval (ml_rhs, ml_pat, env')
goal (1 subgoal):
1. (\<And>pat rhs \<Gamma>'. \<lbrakk>related_pat pat ml_pat; related_exp rhs ml_rhs; vfind_match cs scr' = Some (\<Gamma>', pat, rhs); var_env \<Gamma>' env'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto elim: match_all_related)
[PROOF STATE]
proof (state)
this:
related_pat pat ml_pat
related_exp rhs ml_rhs
vfind_match cs scr' = Some (\<Gamma>', pat, rhs)
var_env \<Gamma>' env'
goal (8 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
5. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
6. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
7. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
8. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
hence "vmatch (mk_pat pat) scr' = Some \<Gamma>'"
[PROOF STATE]
proof (prove)
using this:
related_pat pat ml_pat
related_exp rhs ml_rhs
vfind_match cs scr' = Some (\<Gamma>', pat, rhs)
var_env \<Gamma>' env'
goal (1 subgoal):
1. vmatch (mk_pat pat) scr' = Some \<Gamma>'
[PROOF STEP]
by (auto dest: vfind_match_elem)
[PROOF STATE]
proof (state)
this:
vmatch (mk_pat pat) scr' = Some \<Gamma>'
goal (8 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
5. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
6. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
7. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
8. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
hence "patvars (mk_pat pat) = fmdom \<Gamma>'"
[PROOF STATE]
proof (prove)
using this:
vmatch (mk_pat pat) scr' = Some \<Gamma>'
goal (1 subgoal):
1. patvars (mk_pat pat) = fmdom \<Gamma>'
[PROOF STEP]
by (auto simp: vmatch_dom)
[PROOF STATE]
proof (state)
this:
patvars (mk_pat pat) = fmdom \<Gamma>'
goal (8 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
5. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
6. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
7. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
8. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
have "(pat, rhs) \<in> set cs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (pat, rhs) \<in> set cs
[PROOF STEP]
by (rule vfind_match_elem) fact
[PROOF STATE]
proof (state)
this:
(pat, rhs) \<in> set cs
goal (8 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
5. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
6. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
7. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
8. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
have "linear pat"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. Pats.linear pat
[PROOF STEP]
using \<open>(pat, rhs) \<in> set cs\<close> \<open>wellformed t\<close>
[PROOF STATE]
proof (prove)
using this:
(pat, rhs) \<in> set cs
pre_strong_term_class.wellformed t
goal (1 subgoal):
1. Pats.linear pat
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
using this:
(pat, rhs) \<in> set cs
pre_strong_term_class.wellformed (Sabs cs $\<^sub>s scr)
goal (1 subgoal):
1. Pats.linear pat
[PROOF STEP]
by (auto simp: list_all_iff)
[PROOF STATE]
proof (state)
this:
Pats.linear pat
goal (8 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
5. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
6. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
7. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
8. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
hence "fmdom \<Gamma>' = frees pat"
[PROOF STATE]
proof (prove)
using this:
Pats.linear pat
goal (1 subgoal):
1. fmdom \<Gamma>' = frees pat
[PROOF STEP]
using \<open>patvars (mk_pat pat) = fmdom \<Gamma>'\<close>
[PROOF STATE]
proof (prove)
using this:
Pats.linear pat
patvars (mk_pat pat) = fmdom \<Gamma>'
goal (1 subgoal):
1. fmdom \<Gamma>' = frees pat
[PROOF STEP]
by (simp add: mk_pat_frees)
[PROOF STATE]
proof (state)
this:
fmdom \<Gamma>' = frees pat
goal (8 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
5. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
6. \<And>env e v0 pes e' uu_ env' bv \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rval (e', uu_, env'); cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) e' bv; \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp t e'; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) bv
7. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
8. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) ml_res
[PROOF STEP]
proof (rule if_rvalI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<And>v. ml_res = Rval v \<Longrightarrow> \<exists>va. \<Gamma> \<turnstile>\<^sub>v t \<down> va \<and> related_v va v
[PROOF STEP]
fix ml_rhs'
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<And>v. ml_res = Rval v \<Longrightarrow> \<exists>va. \<Gamma> \<turnstile>\<^sub>v t \<down> va \<and> related_v va v
[PROOF STEP]
assume "ml_res = Rval ml_rhs'"
[PROOF STATE]
proof (state)
this:
ml_res = Rval ml_rhs'
goal (1 subgoal):
1. \<And>v. ml_res = Rval v \<Longrightarrow> \<exists>va. \<Gamma> \<turnstile>\<^sub>v t \<down> va \<and> related_v va v
[PROOF STEP]
obtain rhs' where "\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'" "related_v rhs' ml_rhs'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using mat1(5)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp ?t4 ml_rhs; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) ml_res
goal (1 subgoal):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding \<open>ml_res = _\<close> if_rval.simps
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp ?t4 ml_rhs; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_rhs'
goal (1 subgoal):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (13 subgoals):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env)
2. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmrel_on_fset (ids ?t11) related_v ?\<Gamma>11 (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env)))
3. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> related_exp ?t11 ml_rhs
4. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed ?t11
5. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> wellformed_venv ?\<Gamma>11
6. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_venv ?\<Gamma>11
7. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except ?t11 (fmdom ?\<Gamma>11)
8. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') ?\<Gamma>11
9. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts ?t11 |\<subseteq>| fmdom ?\<Gamma>11 |\<union>| C
10. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom ?\<Gamma>11)
A total of 13 subgoals...
[PROOF STEP]
show "is_cupcake_all_env (env \<lparr> sem_env.v := nsAppend (alist_to_ns env') (sem_env.v env) \<rparr>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env)
[PROOF STEP]
proof (rule cupcake_v_update_preserve)
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. is_cupcake_all_env env
2. is_cupcake_ns (nsAppend (alist_to_ns env') (sem_env.v env))
[PROOF STEP]
have "list_all (is_cupcake_value \<circ> snd) env'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. list_all (is_cupcake_value \<circ> snd) env'
[PROOF STEP]
proof (rule match_all_preserve)
[PROOF STATE]
proof (state)
goal (4 subgoals):
1. cupcake_match_result ?cenv ?v0.0 ?pes ?err_v = Rval (?e, ?p, env')
2. cupcake_c_ns ?cenv
3. is_cupcake_value ?v0.0
4. cupcake_clauses ?pes
[PROOF STEP]
show "cupcake_c_ns (sem_env.c env)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. cupcake_c_ns (sem_env.c env)
[PROOF STEP]
unfolding \<open>sem_env.c env = _\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. cupcake_c_ns as_static_cenv
[PROOF STEP]
by (rule static_cenv)
[PROOF STATE]
proof (state)
this:
cupcake_c_ns (sem_env.c env)
goal (3 subgoals):
1. cupcake_match_result (sem_env.c env) ?v0.0 ?pes ?err_v = Rval (?e, ?p, env')
2. is_cupcake_value ?v0.0
3. cupcake_clauses ?pes
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
1. cupcake_match_result (sem_env.c env) ?v0.0 ?pes ?err_v = Rval (?e, ?p, env')
2. is_cupcake_value ?v0.0
3. cupcake_clauses ?pes
[PROOF STEP]
have "is_cupcake_exp (Mat ml_scr ml_cs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. is_cupcake_exp (Mat ml_scr ml_cs)
[PROOF STEP]
apply (rule related_exp_is_cupcake)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. related_exp ?t (Mat ml_scr ml_cs)
2. pre_strong_term_class.wellformed ?t
[PROOF STEP]
using mat1
[PROOF STATE]
proof (prove)
using this:
cupcake_evaluate_single env ml_scr (Rval ml_scr')
cupcake_match_result (sem_env.c env) ml_scr' ml_cs Bindv = Rval (ml_rhs, ml_pat, env')
cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) ml_rhs ml_res
\<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env)); related_exp ?t4 ml_scr; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) (Rval ml_scr')
\<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp ?t4 ml_rhs; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) ml_res
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (Mat ml_scr ml_cs)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
goal (2 subgoals):
1. related_exp ?t (Mat ml_scr ml_cs)
2. pre_strong_term_class.wellformed ?t
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
is_cupcake_exp (Mat ml_scr ml_cs)
goal (3 subgoals):
1. cupcake_match_result (sem_env.c env) ?v0.0 ?pes ?err_v = Rval (?e, ?p, env')
2. is_cupcake_value ?v0.0
3. cupcake_clauses ?pes
[PROOF STEP]
thus "cupcake_clauses ml_cs"
[PROOF STATE]
proof (prove)
using this:
is_cupcake_exp (Mat ml_scr ml_cs)
goal (1 subgoal):
1. cupcake_clauses ml_cs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cupcake_clauses ml_cs
goal (2 subgoals):
1. cupcake_match_result (sem_env.c env) ?v0.0 ml_cs ?err_v = Rval (?e, ?p, env')
2. is_cupcake_value ?v0.0
[PROOF STEP]
show "is_cupcake_value ml_scr'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. is_cupcake_value ml_scr'
[PROOF STEP]
apply (rule cupcake_single_preserve)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. cupcake_evaluate_single ?env ?e (Rval ml_scr')
2. is_cupcake_all_env ?env
3. is_cupcake_exp ?e
[PROOF STEP]
apply (rule mat1)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. is_cupcake_all_env env
2. is_cupcake_exp ml_scr
[PROOF STEP]
apply (rule mat1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. is_cupcake_exp ml_scr
[PROOF STEP]
using \<open>is_cupcake_exp (Mat ml_scr ml_cs)\<close>
[PROOF STATE]
proof (prove)
using this:
is_cupcake_exp (Mat ml_scr ml_cs)
goal (1 subgoal):
1. is_cupcake_exp ml_scr
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
is_cupcake_value ml_scr'
goal (1 subgoal):
1. cupcake_match_result (sem_env.c env) ml_scr' ml_cs ?err_v = Rval (?e, ?p, env')
[PROOF STEP]
qed fact+
[PROOF STATE]
proof (state)
this:
list_all (is_cupcake_value \<circ> snd) env'
goal (2 subgoals):
1. is_cupcake_all_env env
2. is_cupcake_ns (nsAppend (alist_to_ns env') (sem_env.v env))
[PROOF STEP]
hence "is_cupcake_ns (alist_to_ns env')"
[PROOF STATE]
proof (prove)
using this:
list_all (is_cupcake_value \<circ> snd) env'
goal (1 subgoal):
1. is_cupcake_ns (alist_to_ns env')
[PROOF STEP]
by (rule cupcake_alist_to_ns_preserve)
[PROOF STATE]
proof (state)
this:
is_cupcake_ns (alist_to_ns env')
goal (2 subgoals):
1. is_cupcake_all_env env
2. is_cupcake_ns (nsAppend (alist_to_ns env') (sem_env.v env))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
is_cupcake_ns (alist_to_ns env')
goal (2 subgoals):
1. is_cupcake_all_env env
2. is_cupcake_ns (nsAppend (alist_to_ns env') (sem_env.v env))
[PROOF STEP]
have "is_cupcake_ns (sem_env.v env)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. is_cupcake_ns (sem_env.v env)
[PROOF STEP]
by (rule is_cupcake_all_envD) fact
[PROOF STATE]
proof (state)
this:
is_cupcake_ns (sem_env.v env)
goal (2 subgoals):
1. is_cupcake_all_env env
2. is_cupcake_ns (nsAppend (alist_to_ns env') (sem_env.v env))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
is_cupcake_ns (alist_to_ns env')
is_cupcake_ns (sem_env.v env)
[PROOF STEP]
show "is_cupcake_ns (nsAppend (alist_to_ns env') (sem_env.v env))"
[PROOF STATE]
proof (prove)
using this:
is_cupcake_ns (alist_to_ns env')
is_cupcake_ns (sem_env.v env)
goal (1 subgoal):
1. is_cupcake_ns (nsAppend (alist_to_ns env') (sem_env.v env))
[PROOF STEP]
by (rule cupcake_nsAppend_preserve)
[PROOF STATE]
proof (state)
this:
is_cupcake_ns (nsAppend (alist_to_ns env') (sem_env.v env))
goal (1 subgoal):
1. is_cupcake_all_env env
[PROOF STEP]
qed fact
[PROOF STATE]
proof (state)
this:
is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env)
goal (12 subgoals):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmrel_on_fset (ids ?t11) related_v ?\<Gamma>11 (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env)))
2. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> related_exp ?t11 ml_rhs
3. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed ?t11
4. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> wellformed_venv ?\<Gamma>11
5. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_venv ?\<Gamma>11
6. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except ?t11 (fmdom ?\<Gamma>11)
7. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') ?\<Gamma>11
8. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts ?t11 |\<subseteq>| fmdom ?\<Gamma>11 |\<union>| C
9. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom ?\<Gamma>11)
10. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts ?t11
A total of 12 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (12 subgoals):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmrel_on_fset (ids ?t11) related_v ?\<Gamma>11 (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env)))
2. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> related_exp ?t11 ml_rhs
3. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed ?t11
4. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> wellformed_venv ?\<Gamma>11
5. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_venv ?\<Gamma>11
6. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except ?t11 (fmdom ?\<Gamma>11)
7. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') ?\<Gamma>11
8. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts ?t11 |\<subseteq>| fmdom ?\<Gamma>11 |\<union>| C
9. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom ?\<Gamma>11)
10. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts ?t11
A total of 12 subgoals...
[PROOF STEP]
show "related_exp rhs ml_rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. related_exp rhs ml_rhs
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
related_exp rhs ml_rhs
goal (11 subgoals):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmrel_on_fset (ids rhs) related_v ?\<Gamma>11 (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env)))
2. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
3. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> wellformed_venv ?\<Gamma>11
4. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_venv ?\<Gamma>11
5. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom ?\<Gamma>11)
6. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') ?\<Gamma>11
7. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom ?\<Gamma>11 |\<union>| C
8. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom ?\<Gamma>11)
9. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
10. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env ?\<Gamma>11
A total of 11 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (11 subgoals):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmrel_on_fset (ids rhs) related_v ?\<Gamma>11 (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env)))
2. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
3. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> wellformed_venv ?\<Gamma>11
4. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_venv ?\<Gamma>11
5. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom ?\<Gamma>11)
6. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') ?\<Gamma>11
7. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom ?\<Gamma>11 |\<union>| C
8. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom ?\<Gamma>11)
9. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
10. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env ?\<Gamma>11
A total of 11 subgoals...
[PROOF STEP]
have *: "fmdom (fmap_of_list (map (map_prod Name id) env')) = fmdom \<Gamma>'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmdom (fmap_of_list (map (map_prod Name id) env')) = fmdom \<Gamma>'
[PROOF STEP]
using \<open>var_env \<Gamma>' env'\<close>
[PROOF STATE]
proof (prove)
using this:
var_env \<Gamma>' env'
goal (1 subgoal):
1. fmdom (fmap_of_list (map (map_prod Name id) env')) = fmdom \<Gamma>'
[PROOF STEP]
by (metis fmrel_fmdom_eq)
[PROOF STATE]
proof (state)
this:
fmdom (fmap_of_list (map (map_prod Name id) env')) = fmdom \<Gamma>'
goal (11 subgoals):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmrel_on_fset (ids rhs) related_v ?\<Gamma>11 (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env)))
2. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
3. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> wellformed_venv ?\<Gamma>11
4. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_venv ?\<Gamma>11
5. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom ?\<Gamma>11)
6. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') ?\<Gamma>11
7. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom ?\<Gamma>11 |\<union>| C
8. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom ?\<Gamma>11)
9. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
10. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env ?\<Gamma>11
A total of 11 subgoals...
[PROOF STEP]
have **: "id |\<in>| ids t" if "id |\<in>| ids rhs" "id |\<notin>| fmdom \<Gamma>'" for id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. id |\<in>| ids t
[PROOF STEP]
using \<open>id |\<in>| ids rhs\<close>
[PROOF STATE]
proof (prove)
using this:
id |\<in>| ids rhs
goal (1 subgoal):
1. id |\<in>| ids t
[PROOF STEP]
unfolding ids_def
[PROOF STATE]
proof (prove)
using this:
id |\<in>| frees rhs |\<union>| consts rhs
goal (1 subgoal):
1. id |\<in>| frees t |\<union>| consts t
[PROOF STEP]
proof (cases rule: funion_strictE)
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. id |\<in>| frees rhs \<Longrightarrow> id |\<in>| frees t |\<union>| consts t
2. \<lbrakk>id |\<notin>| frees rhs; id |\<in>| consts rhs\<rbrakk> \<Longrightarrow> id |\<in>| frees t |\<union>| consts t
[PROOF STEP]
case A
[PROOF STATE]
proof (state)
this:
id |\<in>| frees rhs
goal (2 subgoals):
1. id |\<in>| frees rhs \<Longrightarrow> id |\<in>| frees t |\<union>| consts t
2. \<lbrakk>id |\<notin>| frees rhs; id |\<in>| consts rhs\<rbrakk> \<Longrightarrow> id |\<in>| frees t |\<union>| consts t
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
id |\<in>| ids rhs
id |\<notin>| fmdom \<Gamma>'
[PROOF STEP]
have "id |\<notin>| frees pat"
[PROOF STATE]
proof (prove)
using this:
id |\<in>| ids rhs
id |\<notin>| fmdom \<Gamma>'
goal (1 subgoal):
1. id |\<notin>| frees pat
[PROOF STEP]
unfolding \<open>fmdom \<Gamma>' = frees pat\<close>
[PROOF STATE]
proof (prove)
using this:
id |\<in>| ids rhs
id |\<notin>| frees pat
goal (1 subgoal):
1. id |\<notin>| frees pat
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
id |\<notin>| frees pat
goal (2 subgoals):
1. id |\<in>| frees rhs \<Longrightarrow> id |\<in>| frees t |\<union>| consts t
2. \<lbrakk>id |\<notin>| frees rhs; id |\<in>| consts rhs\<rbrakk> \<Longrightarrow> id |\<in>| frees t |\<union>| consts t
[PROOF STEP]
hence "id |\<in>| frees t"
[PROOF STATE]
proof (prove)
using this:
id |\<notin>| frees pat
goal (1 subgoal):
1. id |\<in>| frees t
[PROOF STEP]
using \<open>(pat, rhs) \<in> set cs\<close>
[PROOF STATE]
proof (prove)
using this:
id |\<notin>| frees pat
(pat, rhs) \<in> set cs
goal (1 subgoal):
1. id |\<in>| frees t
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
using this:
id |\<notin>| frees pat
(pat, rhs) \<in> set cs
goal (1 subgoal):
1. id |\<in>| frees (Sabs cs $\<^sub>s scr)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>id |\<notin>| frees pat; (pat, rhs) \<in> set cs; id |\<notin>| frees scr\<rbrakk> \<Longrightarrow> id |\<in>| ffUnion ((\<lambda>(pat, rhs). frees rhs |-| frees pat) |`| fset_of_list cs)
[PROOF STEP]
apply (subst ffUnion_alt_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>id |\<notin>| frees pat; (pat, rhs) \<in> set cs; id |\<notin>| frees scr\<rbrakk> \<Longrightarrow> fBex ((\<lambda>(pat, rhs). frees rhs |-| frees pat) |`| fset_of_list cs) ((|\<in>|) id)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>id |\<notin>| frees pat; (pat, rhs) \<in> set cs; id |\<notin>| frees scr\<rbrakk> \<Longrightarrow> fBex (fset_of_list cs) (\<lambda>x. id |\<in>| (case x of (pat, rhs) \<Rightarrow> frees rhs |-| frees pat))
[PROOF STEP]
apply (rule fBexI[where x = "(pat, rhs)"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<lbrakk>id |\<notin>| frees pat; (pat, rhs) \<in> set cs; id |\<notin>| frees scr\<rbrakk> \<Longrightarrow> id |\<in>| (case (pat, rhs) of (pat, rhs) \<Rightarrow> frees rhs |-| frees pat)
2. \<lbrakk>id |\<notin>| frees pat; (pat, rhs) \<in> set cs; id |\<notin>| frees scr\<rbrakk> \<Longrightarrow> (pat, rhs) |\<in>| fset_of_list cs
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
id |\<in>| frees rhs
goal (2 subgoals):
1. \<lbrakk>id |\<notin>| frees pat; (pat, rhs) \<in> set cs; id |\<notin>| frees scr\<rbrakk> \<Longrightarrow> id |\<in>| (case (pat, rhs) of (pat, rhs) \<Rightarrow> frees rhs |-| frees pat)
2. \<lbrakk>id |\<notin>| frees pat; (pat, rhs) \<in> set cs; id |\<notin>| frees scr\<rbrakk> \<Longrightarrow> (pat, rhs) |\<in>| fset_of_list cs
[PROOF STEP]
apply (auto simp: fset_of_list_elem)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
id |\<in>| frees t
goal (2 subgoals):
1. id |\<in>| frees rhs \<Longrightarrow> id |\<in>| frees t |\<union>| consts t
2. \<lbrakk>id |\<notin>| frees rhs; id |\<in>| consts rhs\<rbrakk> \<Longrightarrow> id |\<in>| frees t |\<union>| consts t
[PROOF STEP]
thus "id |\<in>| frees t |\<union>| consts t"
[PROOF STATE]
proof (prove)
using this:
id |\<in>| frees t
goal (1 subgoal):
1. id |\<in>| frees t |\<union>| consts t
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
id |\<in>| frees t |\<union>| consts t
goal (1 subgoal):
1. \<lbrakk>id |\<notin>| frees rhs; id |\<in>| consts rhs\<rbrakk> \<Longrightarrow> id |\<in>| frees t |\<union>| consts t
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<lbrakk>id |\<notin>| frees rhs; id |\<in>| consts rhs\<rbrakk> \<Longrightarrow> id |\<in>| frees t |\<union>| consts t
[PROOF STEP]
case B
[PROOF STATE]
proof (state)
this:
id |\<notin>| frees rhs
id |\<in>| consts rhs
goal (1 subgoal):
1. \<lbrakk>id |\<notin>| frees rhs; id |\<in>| consts rhs\<rbrakk> \<Longrightarrow> id |\<in>| frees t |\<union>| consts t
[PROOF STEP]
hence "id |\<in>| consts t"
[PROOF STATE]
proof (prove)
using this:
id |\<notin>| frees rhs
id |\<in>| consts rhs
goal (1 subgoal):
1. id |\<in>| consts t
[PROOF STEP]
using \<open>(pat, rhs) \<in> set cs\<close>
[PROOF STATE]
proof (prove)
using this:
id |\<notin>| frees rhs
id |\<in>| consts rhs
(pat, rhs) \<in> set cs
goal (1 subgoal):
1. id |\<in>| consts t
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
using this:
id |\<notin>| frees rhs
id |\<in>| consts rhs
(pat, rhs) \<in> set cs
goal (1 subgoal):
1. id |\<in>| consts (Sabs cs $\<^sub>s scr)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>id |\<notin>| frees rhs; id |\<in>| consts rhs; (pat, rhs) \<in> set cs; id |\<notin>| consts scr\<rbrakk> \<Longrightarrow> id |\<in>| ffUnion ((\<lambda>(uu_, y). consts y) |`| fset_of_list cs)
[PROOF STEP]
apply (subst ffUnion_alt_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>id |\<notin>| frees rhs; id |\<in>| consts rhs; (pat, rhs) \<in> set cs; id |\<notin>| consts scr\<rbrakk> \<Longrightarrow> fBex ((\<lambda>(uu_, y). consts y) |`| fset_of_list cs) ((|\<in>|) id)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>id |\<notin>| frees rhs; id |\<in>| consts rhs; (pat, rhs) \<in> set cs; id |\<notin>| consts scr\<rbrakk> \<Longrightarrow> fBex (fset_of_list cs) (\<lambda>x. id |\<in>| (case x of (uu_, x) \<Rightarrow> consts x))
[PROOF STEP]
apply (rule fBexI[where x = "(pat, rhs)"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<lbrakk>id |\<notin>| frees rhs; id |\<in>| consts rhs; (pat, rhs) \<in> set cs; id |\<notin>| consts scr\<rbrakk> \<Longrightarrow> id |\<in>| (case (pat, rhs) of (uu_, x) \<Rightarrow> consts x)
2. \<lbrakk>id |\<notin>| frees rhs; id |\<in>| consts rhs; (pat, rhs) \<in> set cs; id |\<notin>| consts scr\<rbrakk> \<Longrightarrow> (pat, rhs) |\<in>| fset_of_list cs
[PROOF STEP]
apply (auto simp: fset_of_list_elem)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
id |\<in>| consts t
goal (1 subgoal):
1. \<lbrakk>id |\<notin>| frees rhs; id |\<in>| consts rhs\<rbrakk> \<Longrightarrow> id |\<in>| frees t |\<union>| consts t
[PROOF STEP]
thus "id |\<in>| frees t |\<union>| consts t"
[PROOF STATE]
proof (prove)
using this:
id |\<in>| consts t
goal (1 subgoal):
1. id |\<in>| frees t |\<union>| consts t
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
id |\<in>| frees t |\<union>| consts t
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?id4 |\<in>| ids rhs; ?id4 |\<notin>| fmdom \<Gamma>'\<rbrakk> \<Longrightarrow> ?id4 |\<in>| ids t
goal (11 subgoals):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmrel_on_fset (ids rhs) related_v ?\<Gamma>11 (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env)))
2. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
3. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> wellformed_venv ?\<Gamma>11
4. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_venv ?\<Gamma>11
5. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom ?\<Gamma>11)
6. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') ?\<Gamma>11
7. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom ?\<Gamma>11 |\<union>| C
8. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom ?\<Gamma>11)
9. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
10. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env ?\<Gamma>11
A total of 11 subgoals...
[PROOF STEP]
have "fmrel_on_fset (ids rhs) related_v (\<Gamma> ++\<^sub>f \<Gamma>') (fmap_of_ns (sem_env.v env) ++\<^sub>f fmap_of_list (map (map_prod Name id) env'))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmrel_on_fset (ids rhs) related_v (\<Gamma> ++\<^sub>f \<Gamma>') (fmap_of_ns (sem_env.v env) ++\<^sub>f fmap_of_list (map (map_prod Name id) env'))
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<And>x. x |\<in>| ids rhs \<Longrightarrow> rel_option related_v (fmlookup (\<Gamma> ++\<^sub>f \<Gamma>') x) (fmlookup (fmap_of_ns (sem_env.v env) ++\<^sub>f fmap_of_list (map (map_prod Name id) env')) x)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<And>x. x |\<in>| ids rhs \<Longrightarrow> (x |\<in>| fmdom \<Gamma>' \<longrightarrow> (x |\<in>| (Name \<circ> fst) |`| fset_of_list env' \<longrightarrow> rel_option related_v (fmlookup \<Gamma>' x) (fmlookup (fmap_of_list (map (map_prod Name id) env')) x)) \<and> (x |\<notin>| (Name \<circ> fst) |`| fset_of_list env' \<longrightarrow> rel_option related_v (fmlookup \<Gamma>' x) (cupcake_nsLookup (sem_env.v env) (as_string x)))) \<and> (x |\<notin>| fmdom \<Gamma>' \<longrightarrow> (x |\<in>| (Name \<circ> fst) |`| fset_of_list env' \<longrightarrow> rel_option related_v (fmlookup \<Gamma> x) (fmlookup (fmap_of_list (map (map_prod Name id) env')) x)) \<and> (x |\<notin>| (Name \<circ> fst) |`| fset_of_list env' \<longrightarrow> rel_option related_v (fmlookup \<Gamma> x) (cupcake_nsLookup (sem_env.v env) (as_string x))))
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (4 subgoals):
1. \<And>x a b. \<lbrakk>(Name \<circ> fst) (a, b) |\<in>| ids rhs; (Name \<circ> fst) (a, b) |\<in>| fmdom \<Gamma>'; (a, b) |\<in>| fset_of_list env'\<rbrakk> \<Longrightarrow> rel_option related_v (fmlookup \<Gamma>' ((Name \<circ> fst) (a, b))) (fmlookup (fmap_of_list (map (map_prod Name id) env')) ((Name \<circ> fst) (a, b)))
2. \<And>x. \<lbrakk>x |\<in>| ids rhs; x |\<in>| fmdom \<Gamma>'; x |\<notin>| (Name \<circ> fst) |`| fset_of_list env'\<rbrakk> \<Longrightarrow> rel_option related_v (fmlookup \<Gamma>' x) (cupcake_nsLookup (sem_env.v env) (as_string x))
3. \<And>x a b. \<lbrakk>(Name \<circ> fst) (a, b) |\<in>| ids rhs; (Name \<circ> fst) (a, b) |\<notin>| fmdom \<Gamma>'; (a, b) |\<in>| fset_of_list env'\<rbrakk> \<Longrightarrow> rel_option related_v (fmlookup \<Gamma> ((Name \<circ> fst) (a, b))) (fmlookup (fmap_of_list (map (map_prod Name id) env')) ((Name \<circ> fst) (a, b)))
4. \<And>x. \<lbrakk>x |\<in>| ids rhs; x |\<notin>| fmdom \<Gamma>'; x |\<notin>| (Name \<circ> fst) |`| fset_of_list env'\<rbrakk> \<Longrightarrow> rel_option related_v (fmlookup \<Gamma> x) (cupcake_nsLookup (sem_env.v env) (as_string x))
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>(Name \<circ> fst) (a_, b_) |\<in>| ids rhs; (Name \<circ> fst) (a_, b_) |\<in>| fmdom \<Gamma>'; (a_, b_) |\<in>| fset_of_list env'\<rbrakk> \<Longrightarrow> rel_option related_v (fmlookup \<Gamma>' ((Name \<circ> fst) (a_, b_))) (fmlookup (fmap_of_list (map (map_prod Name id) env')) ((Name \<circ> fst) (a_, b_)))
[PROOF STEP]
apply (rule fmrelD)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>(Name \<circ> fst) (a_, b_) |\<in>| ids rhs; (Name \<circ> fst) (a_, b_) |\<in>| fmdom \<Gamma>'; (a_, b_) |\<in>| fset_of_list env'\<rbrakk> \<Longrightarrow> var_env \<Gamma>' env'
[PROOF STEP]
apply (rule \<open>var_env \<Gamma>' env'\<close>)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. \<And>x. \<lbrakk>x |\<in>| ids rhs; x |\<in>| fmdom \<Gamma>'; x |\<notin>| (Name \<circ> fst) |`| fset_of_list env'\<rbrakk> \<Longrightarrow> rel_option related_v (fmlookup \<Gamma>' x) (cupcake_nsLookup (sem_env.v env) (as_string x))
2. \<And>x a b. \<lbrakk>(Name \<circ> fst) (a, b) |\<in>| ids rhs; (Name \<circ> fst) (a, b) |\<notin>| fmdom \<Gamma>'; (a, b) |\<in>| fset_of_list env'\<rbrakk> \<Longrightarrow> rel_option related_v (fmlookup \<Gamma> ((Name \<circ> fst) (a, b))) (fmlookup (fmap_of_list (map (map_prod Name id) env')) ((Name \<circ> fst) (a, b)))
3. \<And>x. \<lbrakk>x |\<in>| ids rhs; x |\<notin>| fmdom \<Gamma>'; x |\<notin>| (Name \<circ> fst) |`| fset_of_list env'\<rbrakk> \<Longrightarrow> rel_option related_v (fmlookup \<Gamma> x) (cupcake_nsLookup (sem_env.v env) (as_string x))
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>x_ |\<in>| ids rhs; x_ |\<in>| fmdom \<Gamma>'; x_ |\<notin>| (Name \<circ> fst) |`| fset_of_list env'\<rbrakk> \<Longrightarrow> rel_option related_v (fmlookup \<Gamma>' x_) (cupcake_nsLookup (sem_env.v env) (as_string x_))
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
fmdom (fmap_of_list (map (map_prod Name id) env')) = fmdom \<Gamma>'
goal (1 subgoal):
1. \<lbrakk>x_ |\<in>| ids rhs; x_ |\<in>| fmdom \<Gamma>'; x_ |\<notin>| (Name \<circ> fst) |`| fset_of_list env'\<rbrakk> \<Longrightarrow> rel_option related_v (fmlookup \<Gamma>' x_) (cupcake_nsLookup (sem_env.v env) (as_string x_))
[PROOF STEP]
by simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<And>x a b. \<lbrakk>(Name \<circ> fst) (a, b) |\<in>| ids rhs; (Name \<circ> fst) (a, b) |\<notin>| fmdom \<Gamma>'; (a, b) |\<in>| fset_of_list env'\<rbrakk> \<Longrightarrow> rel_option related_v (fmlookup \<Gamma> ((Name \<circ> fst) (a, b))) (fmlookup (fmap_of_list (map (map_prod Name id) env')) ((Name \<circ> fst) (a, b)))
2. \<And>x. \<lbrakk>x |\<in>| ids rhs; x |\<notin>| fmdom \<Gamma>'; x |\<notin>| (Name \<circ> fst) |`| fset_of_list env'\<rbrakk> \<Longrightarrow> rel_option related_v (fmlookup \<Gamma> x) (cupcake_nsLookup (sem_env.v env) (as_string x))
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>(Name \<circ> fst) (a_, b_) |\<in>| ids rhs; (Name \<circ> fst) (a_, b_) |\<notin>| fmdom \<Gamma>'; (a_, b_) |\<in>| fset_of_list env'\<rbrakk> \<Longrightarrow> rel_option related_v (fmlookup \<Gamma> ((Name \<circ> fst) (a_, b_))) (fmlookup (fmap_of_list (map (map_prod Name id) env')) ((Name \<circ> fst) (a_, b_)))
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
fmdom (fmap_of_list (map (map_prod Name id) env')) = fmdom \<Gamma>'
goal (1 subgoal):
1. \<lbrakk>(Name \<circ> fst) (a_, b_) |\<in>| ids rhs; (Name \<circ> fst) (a_, b_) |\<notin>| fmdom \<Gamma>'; (a_, b_) |\<in>| fset_of_list env'\<rbrakk> \<Longrightarrow> rel_option related_v (fmlookup \<Gamma> ((Name \<circ> fst) (a_, b_))) (fmlookup (fmap_of_list (map (map_prod Name id) env')) ((Name \<circ> fst) (a_, b_)))
[PROOF STEP]
by (metis (no_types, opaque_lifting) comp_def fimageI fmdom_fmap_of_list fset_of_list_map fst_comp_map_prod)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<And>x. \<lbrakk>x |\<in>| ids rhs; x |\<notin>| fmdom \<Gamma>'; x |\<notin>| (Name \<circ> fst) |`| fset_of_list env'\<rbrakk> \<Longrightarrow> rel_option related_v (fmlookup \<Gamma> x) (cupcake_nsLookup (sem_env.v env) (as_string x))
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>x_ |\<in>| ids rhs; x_ |\<notin>| fmdom \<Gamma>'; x_ |\<notin>| (Name \<circ> fst) |`| fset_of_list env'\<rbrakk> \<Longrightarrow> rel_option related_v (fmlookup \<Gamma> x_) (cupcake_nsLookup (sem_env.v env) (as_string x_))
[PROOF STEP]
using **
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?id4 |\<in>| ids rhs; ?id4 |\<notin>| fmdom \<Gamma>'\<rbrakk> \<Longrightarrow> ?id4 |\<in>| ids t
goal (1 subgoal):
1. \<lbrakk>x_ |\<in>| ids rhs; x_ |\<notin>| fmdom \<Gamma>'; x_ |\<notin>| (Name \<circ> fst) |`| fset_of_list env'\<rbrakk> \<Longrightarrow> rel_option related_v (fmlookup \<Gamma> x_) (cupcake_nsLookup (sem_env.v env) (as_string x_))
[PROOF STEP]
by (metis fmlookup_ns fmrel_on_fsetD mat1.prems(2))
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
fmrel_on_fset (ids rhs) related_v (\<Gamma> ++\<^sub>f \<Gamma>') (fmap_of_ns (sem_env.v env) ++\<^sub>f fmap_of_list (map (map_prod Name id) env'))
goal (11 subgoals):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmrel_on_fset (ids rhs) related_v ?\<Gamma>11 (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env)))
2. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
3. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> wellformed_venv ?\<Gamma>11
4. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_venv ?\<Gamma>11
5. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom ?\<Gamma>11)
6. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') ?\<Gamma>11
7. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom ?\<Gamma>11 |\<union>| C
8. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom ?\<Gamma>11)
9. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
10. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env ?\<Gamma>11
A total of 11 subgoals...
[PROOF STEP]
thus "fmrel_on_fset (ids rhs) related_v (\<Gamma> ++\<^sub>f \<Gamma>') (fmap_of_ns (sem_env.v (env \<lparr> sem_env.v := nsAppend (alist_to_ns env') (sem_env.v env) \<rparr>)))"
[PROOF STATE]
proof (prove)
using this:
fmrel_on_fset (ids rhs) related_v (\<Gamma> ++\<^sub>f \<Gamma>') (fmap_of_ns (sem_env.v env) ++\<^sub>f fmap_of_list (map (map_prod Name id) env'))
goal (1 subgoal):
1. fmrel_on_fset (ids rhs) related_v (\<Gamma> ++\<^sub>f \<Gamma>') (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env)))
[PROOF STEP]
by (auto split: sem_env.splits)
[PROOF STATE]
proof (state)
this:
fmrel_on_fset (ids rhs) related_v (\<Gamma> ++\<^sub>f \<Gamma>') (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env)))
goal (10 subgoals):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
2. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> wellformed_venv (\<Gamma> ++\<^sub>f \<Gamma>')
3. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_venv (\<Gamma> ++\<^sub>f \<Gamma>')
4. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
5. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (\<Gamma> ++\<^sub>f \<Gamma>')
6. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (\<Gamma> ++\<^sub>f \<Gamma>') |\<union>| C
7. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
8. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
9. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (\<Gamma> ++\<^sub>f \<Gamma>')
10. \<And>x. \<lbrakk>\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis; \<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> x \<and> related_v x ml_rhs'\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (10 subgoals):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
2. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> wellformed_venv (\<Gamma> ++\<^sub>f \<Gamma>')
3. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_venv (\<Gamma> ++\<^sub>f \<Gamma>')
4. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
5. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (\<Gamma> ++\<^sub>f \<Gamma>')
6. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (\<Gamma> ++\<^sub>f \<Gamma>') |\<union>| C
7. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
8. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
9. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (\<Gamma> ++\<^sub>f \<Gamma>')
10. \<And>x. \<lbrakk>\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis; \<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> x \<and> related_v x ml_rhs'\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show "wellformed_venv (\<Gamma> ++\<^sub>f \<Gamma>')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. wellformed_venv (\<Gamma> ++\<^sub>f \<Gamma>')
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. wellformed_venv \<Gamma>
2. wellformed_venv \<Gamma>'
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. wellformed_venv \<Gamma>'
[PROOF STEP]
apply (rule vwellformed.vmatch_env)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. vmatch ?pat4 ?v4 = Some \<Gamma>'
2. vwellformed ?v4
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. vwellformed scr'
[PROOF STEP]
apply (rule veval'_wellformed)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. ?\<Gamma>8 \<turnstile>\<^sub>v ?t8 \<down> scr'
2. pre_strong_term_class.wellformed ?t8
3. wellformed_venv ?\<Gamma>8
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. pre_strong_term_class.wellformed scr
2. wellformed_venv \<Gamma>
[PROOF STEP]
using mat1
[PROOF STATE]
proof (prove)
using this:
cupcake_evaluate_single env ml_scr (Rval ml_scr')
cupcake_match_result (sem_env.c env) ml_scr' ml_cs Bindv = Rval (ml_rhs, ml_pat, env')
cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) ml_rhs ml_res
\<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env)); related_exp ?t4 ml_scr; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) (Rval ml_scr')
\<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp ?t4 ml_rhs; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) ml_res
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (Mat ml_scr ml_cs)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
goal (2 subgoals):
1. pre_strong_term_class.wellformed scr
2. wellformed_venv \<Gamma>
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
using this:
cupcake_evaluate_single env ml_scr (Rval ml_scr')
cupcake_match_result (sem_env.c env) ml_scr' ml_cs Bindv = Rval (ml_rhs, ml_pat, env')
cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) ml_rhs ml_res
\<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env)); related_exp ?t4 ml_scr; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) (Rval ml_scr')
\<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp ?t4 ml_rhs; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) ml_res
is_cupcake_all_env env
fmrel_on_fset (ids (Sabs cs $\<^sub>s scr)) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp (Sabs cs $\<^sub>s scr) (Mat ml_scr ml_cs)
pre_strong_term_class.wellformed (Sabs cs $\<^sub>s scr)
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except (Sabs cs $\<^sub>s scr) (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts (Sabs cs $\<^sub>s scr) |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts (Sabs cs $\<^sub>s scr)
not_shadows_vconsts_env \<Gamma>
goal (2 subgoals):
1. pre_strong_term_class.wellformed scr
2. wellformed_venv \<Gamma>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
wellformed_venv (\<Gamma> ++\<^sub>f \<Gamma>')
goal (9 subgoals):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
2. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_venv (\<Gamma> ++\<^sub>f \<Gamma>')
3. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
4. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (\<Gamma> ++\<^sub>f \<Gamma>')
5. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (\<Gamma> ++\<^sub>f \<Gamma>') |\<union>| C
6. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
7. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
8. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (\<Gamma> ++\<^sub>f \<Gamma>')
9. \<And>x. \<lbrakk>\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis; \<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> x \<and> related_v x ml_rhs'\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (9 subgoals):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
2. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_venv (\<Gamma> ++\<^sub>f \<Gamma>')
3. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
4. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (\<Gamma> ++\<^sub>f \<Gamma>')
5. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (\<Gamma> ++\<^sub>f \<Gamma>') |\<union>| C
6. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
7. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
8. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (\<Gamma> ++\<^sub>f \<Gamma>')
9. \<And>x. \<lbrakk>\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis; \<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> x \<and> related_v x ml_rhs'\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show "closed_venv (\<Gamma> ++\<^sub>f \<Gamma>')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. closed_venv (\<Gamma> ++\<^sub>f \<Gamma>')
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. closed_venv \<Gamma>
2. closed_venv \<Gamma>'
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. closed_venv \<Gamma>'
[PROOF STEP]
apply (rule vclosed.vmatch_env)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. vmatch ?pat4 ?v4 = Some \<Gamma>'
2. vclosed ?v4
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. vclosed scr'
[PROOF STEP]
apply (rule veval'_closed)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
1. ?\<Gamma>8 \<turnstile>\<^sub>v ?t8 \<down> scr'
2. closed_except ?t8 (fmdom ?\<Gamma>8)
3. closed_venv ?\<Gamma>8
4. pre_strong_term_class.wellformed ?t8
5. wellformed_venv ?\<Gamma>8
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (4 subgoals):
1. closed_except scr (fmdom \<Gamma>)
2. closed_venv \<Gamma>
3. pre_strong_term_class.wellformed scr
4. wellformed_venv \<Gamma>
[PROOF STEP]
using mat1
[PROOF STATE]
proof (prove)
using this:
cupcake_evaluate_single env ml_scr (Rval ml_scr')
cupcake_match_result (sem_env.c env) ml_scr' ml_cs Bindv = Rval (ml_rhs, ml_pat, env')
cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) ml_rhs ml_res
\<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env)); related_exp ?t4 ml_scr; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) (Rval ml_scr')
\<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp ?t4 ml_rhs; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) ml_res
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (Mat ml_scr ml_cs)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
goal (4 subgoals):
1. closed_except scr (fmdom \<Gamma>)
2. closed_venv \<Gamma>
3. pre_strong_term_class.wellformed scr
4. wellformed_venv \<Gamma>
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
using this:
cupcake_evaluate_single env ml_scr (Rval ml_scr')
cupcake_match_result (sem_env.c env) ml_scr' ml_cs Bindv = Rval (ml_rhs, ml_pat, env')
cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) ml_rhs ml_res
\<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env)); related_exp ?t4 ml_scr; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) (Rval ml_scr')
\<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp ?t4 ml_rhs; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) ml_res
is_cupcake_all_env env
fmrel_on_fset (ids (Sabs cs $\<^sub>s scr)) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp (Sabs cs $\<^sub>s scr) (Mat ml_scr ml_cs)
pre_strong_term_class.wellformed (Sabs cs $\<^sub>s scr)
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except (Sabs cs $\<^sub>s scr) (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts (Sabs cs $\<^sub>s scr) |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts (Sabs cs $\<^sub>s scr)
not_shadows_vconsts_env \<Gamma>
goal (4 subgoals):
1. closed_except scr (fmdom \<Gamma>)
2. closed_venv \<Gamma>
3. pre_strong_term_class.wellformed scr
4. wellformed_venv \<Gamma>
[PROOF STEP]
by (auto simp: closed_except_def)
[PROOF STATE]
proof (state)
this:
closed_venv (\<Gamma> ++\<^sub>f \<Gamma>')
goal (8 subgoals):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
2. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
3. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (\<Gamma> ++\<^sub>f \<Gamma>')
4. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (\<Gamma> ++\<^sub>f \<Gamma>') |\<union>| C
5. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
6. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
7. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (\<Gamma> ++\<^sub>f \<Gamma>')
8. \<And>x. \<lbrakk>\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis; \<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> x \<and> related_v x ml_rhs'\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (8 subgoals):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
2. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
3. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fmpred (\<lambda>_. vwelldefined') (\<Gamma> ++\<^sub>f \<Gamma>')
4. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (\<Gamma> ++\<^sub>f \<Gamma>') |\<union>| C
5. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
6. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
7. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (\<Gamma> ++\<^sub>f \<Gamma>')
8. \<And>x. \<lbrakk>\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis; \<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> x \<and> related_v x ml_rhs'\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show "fmpred (\<lambda>_. vwelldefined') (\<Gamma> ++\<^sub>f \<Gamma>')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmpred (\<lambda>_. vwelldefined') (\<Gamma> ++\<^sub>f \<Gamma>')
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. fmpred (\<lambda>_. vwelldefined') \<Gamma>
2. fmpred (\<lambda>_. vwelldefined') \<Gamma>'
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fmpred (\<lambda>_. vwelldefined') \<Gamma>'
[PROOF STEP]
apply (rule vmatch_welldefined')
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. vmatch ?pat4 ?v4 = Some \<Gamma>'
2. vwelldefined' ?v4
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. vwelldefined' scr'
[PROOF STEP]
apply (rule veval'_welldefined')
[PROOF STATE]
proof (prove)
goal (8 subgoals):
1. ?\<Gamma>8 \<turnstile>\<^sub>v ?t8 \<down> scr'
2. fdisjnt C (fmdom ?\<Gamma>8)
3. consts ?t8 |\<subseteq>| fmdom ?\<Gamma>8 |\<union>| C
4. fmpred (\<lambda>_. vwelldefined') ?\<Gamma>8
5. pre_strong_term_class.wellformed ?t8
6. wellformed_venv ?\<Gamma>8
7. \<not> shadows_consts ?t8
8. not_shadows_vconsts_env ?\<Gamma>8
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (7 subgoals):
1. fdisjnt C (fmdom \<Gamma>)
2. consts scr |\<subseteq>| fmdom \<Gamma> |\<union>| C
3. fmpred (\<lambda>_. vwelldefined') \<Gamma>
4. pre_strong_term_class.wellformed scr
5. wellformed_venv \<Gamma>
6. \<not> shadows_consts scr
7. not_shadows_vconsts_env \<Gamma>
[PROOF STEP]
using mat1
[PROOF STATE]
proof (prove)
using this:
cupcake_evaluate_single env ml_scr (Rval ml_scr')
cupcake_match_result (sem_env.c env) ml_scr' ml_cs Bindv = Rval (ml_rhs, ml_pat, env')
cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) ml_rhs ml_res
\<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env)); related_exp ?t4 ml_scr; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) (Rval ml_scr')
\<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp ?t4 ml_rhs; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) ml_res
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (Mat ml_scr ml_cs)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
goal (7 subgoals):
1. fdisjnt C (fmdom \<Gamma>)
2. consts scr |\<subseteq>| fmdom \<Gamma> |\<union>| C
3. fmpred (\<lambda>_. vwelldefined') \<Gamma>
4. pre_strong_term_class.wellformed scr
5. wellformed_venv \<Gamma>
6. \<not> shadows_consts scr
7. not_shadows_vconsts_env \<Gamma>
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
using this:
cupcake_evaluate_single env ml_scr (Rval ml_scr')
cupcake_match_result (sem_env.c env) ml_scr' ml_cs Bindv = Rval (ml_rhs, ml_pat, env')
cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) ml_rhs ml_res
\<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env)); related_exp ?t4 ml_scr; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) (Rval ml_scr')
\<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp ?t4 ml_rhs; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) ml_res
is_cupcake_all_env env
fmrel_on_fset (ids (Sabs cs $\<^sub>s scr)) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp (Sabs cs $\<^sub>s scr) (Mat ml_scr ml_cs)
pre_strong_term_class.wellformed (Sabs cs $\<^sub>s scr)
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except (Sabs cs $\<^sub>s scr) (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts (Sabs cs $\<^sub>s scr) |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts (Sabs cs $\<^sub>s scr)
not_shadows_vconsts_env \<Gamma>
goal (7 subgoals):
1. fdisjnt C (fmdom \<Gamma>)
2. consts scr |\<subseteq>| fmdom \<Gamma> |\<union>| C
3. fmpred (\<lambda>_. vwelldefined') \<Gamma>
4. pre_strong_term_class.wellformed scr
5. wellformed_venv \<Gamma>
6. \<not> shadows_consts scr
7. not_shadows_vconsts_env \<Gamma>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
fmpred (\<lambda>_. vwelldefined') (\<Gamma> ++\<^sub>f \<Gamma>')
goal (7 subgoals):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
2. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
3. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (\<Gamma> ++\<^sub>f \<Gamma>') |\<union>| C
4. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
5. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
6. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (\<Gamma> ++\<^sub>f \<Gamma>')
7. \<And>x. \<lbrakk>\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis; \<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> x \<and> related_v x ml_rhs'\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (7 subgoals):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
2. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
3. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (\<Gamma> ++\<^sub>f \<Gamma>') |\<union>| C
4. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
5. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
6. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> not_shadows_vconsts_env (\<Gamma> ++\<^sub>f \<Gamma>')
7. \<And>x. \<lbrakk>\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis; \<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> x \<and> related_v x ml_rhs'\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show "not_shadows_vconsts_env (\<Gamma> ++\<^sub>f \<Gamma>')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. not_shadows_vconsts_env (\<Gamma> ++\<^sub>f \<Gamma>')
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. not_shadows_vconsts_env \<Gamma>
2. not_shadows_vconsts_env \<Gamma>'
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. not_shadows_vconsts_env \<Gamma>'
[PROOF STEP]
apply (rule not_shadows_vconsts.vmatch_env)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. vmatch ?pat4 ?v4 = Some \<Gamma>'
2. not_shadows_vconsts ?v4
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. not_shadows_vconsts scr'
[PROOF STEP]
apply (rule veval'_shadows)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. ?\<Gamma>8 \<turnstile>\<^sub>v ?t8 \<down> scr'
2. not_shadows_vconsts_env ?\<Gamma>8
3. \<not> shadows_consts ?t8
[PROOF STEP]
apply fact
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. not_shadows_vconsts_env \<Gamma>
2. \<not> shadows_consts scr
[PROOF STEP]
using mat1
[PROOF STATE]
proof (prove)
using this:
cupcake_evaluate_single env ml_scr (Rval ml_scr')
cupcake_match_result (sem_env.c env) ml_scr' ml_cs Bindv = Rval (ml_rhs, ml_pat, env')
cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) ml_rhs ml_res
\<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env)); related_exp ?t4 ml_scr; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) (Rval ml_scr')
\<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp ?t4 ml_rhs; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) ml_res
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (Mat ml_scr ml_cs)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
goal (2 subgoals):
1. not_shadows_vconsts_env \<Gamma>
2. \<not> shadows_consts scr
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
using this:
cupcake_evaluate_single env ml_scr (Rval ml_scr')
cupcake_match_result (sem_env.c env) ml_scr' ml_cs Bindv = Rval (ml_rhs, ml_pat, env')
cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) ml_rhs ml_res
\<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env)); related_exp ?t4 ml_scr; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) (Rval ml_scr')
\<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp ?t4 ml_rhs; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) ml_res
is_cupcake_all_env env
fmrel_on_fset (ids (Sabs cs $\<^sub>s scr)) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp (Sabs cs $\<^sub>s scr) (Mat ml_scr ml_cs)
pre_strong_term_class.wellformed (Sabs cs $\<^sub>s scr)
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except (Sabs cs $\<^sub>s scr) (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts (Sabs cs $\<^sub>s scr) |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts (Sabs cs $\<^sub>s scr)
not_shadows_vconsts_env \<Gamma>
goal (2 subgoals):
1. not_shadows_vconsts_env \<Gamma>
2. \<not> shadows_consts scr
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
not_shadows_vconsts_env (\<Gamma> ++\<^sub>f \<Gamma>')
goal (6 subgoals):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
2. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
3. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (\<Gamma> ++\<^sub>f \<Gamma>') |\<union>| C
4. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
5. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
6. \<And>x. \<lbrakk>\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis; \<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> x \<and> related_v x ml_rhs'\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (6 subgoals):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> pre_strong_term_class.wellformed rhs
2. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
3. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (\<Gamma> ++\<^sub>f \<Gamma>') |\<union>| C
4. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
5. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
6. \<And>x. \<lbrakk>\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis; \<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> x \<and> related_v x ml_rhs'\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show "wellformed rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. pre_strong_term_class.wellformed rhs
[PROOF STEP]
using \<open>(pat, rhs) \<in> set cs\<close> \<open>wellformed t\<close>
[PROOF STATE]
proof (prove)
using this:
(pat, rhs) \<in> set cs
pre_strong_term_class.wellformed t
goal (1 subgoal):
1. pre_strong_term_class.wellformed rhs
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
using this:
(pat, rhs) \<in> set cs
pre_strong_term_class.wellformed (Sabs cs $\<^sub>s scr)
goal (1 subgoal):
1. pre_strong_term_class.wellformed rhs
[PROOF STEP]
by (auto simp: list_all_iff)
[PROOF STATE]
proof (state)
this:
pre_strong_term_class.wellformed rhs
goal (5 subgoals):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
2. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (\<Gamma> ++\<^sub>f \<Gamma>') |\<union>| C
3. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
4. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
5. \<And>x. \<lbrakk>\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis; \<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> x \<and> related_v x ml_rhs'\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (5 subgoals):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> closed_except rhs (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
2. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (\<Gamma> ++\<^sub>f \<Gamma>') |\<union>| C
3. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
4. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
5. \<And>x. \<lbrakk>\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis; \<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> x \<and> related_v x ml_rhs'\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show "closed_except rhs (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. closed_except rhs (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. closed_except rhs (fmdom \<Gamma> |\<union>| fmdom \<Gamma>')
[PROOF STEP]
unfolding \<open>fmdom \<Gamma>' = frees pat\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. closed_except rhs (fmdom \<Gamma> |\<union>| frees pat)
[PROOF STEP]
using \<open>(pat, rhs) \<in> set cs\<close> \<open>closed_except t (fmdom \<Gamma>)\<close>
[PROOF STATE]
proof (prove)
using this:
(pat, rhs) \<in> set cs
closed_except t (fmdom \<Gamma>)
goal (1 subgoal):
1. closed_except rhs (fmdom \<Gamma> |\<union>| frees pat)
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
using this:
(pat, rhs) \<in> set cs
closed_except (Sabs cs $\<^sub>s scr) (fmdom \<Gamma>)
goal (1 subgoal):
1. closed_except rhs (fmdom \<Gamma> |\<union>| frees pat)
[PROOF STEP]
by (auto simp: Sterm.closed_except_simps list_all_iff)
[PROOF STATE]
proof (state)
this:
closed_except rhs (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
goal (4 subgoals):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (\<Gamma> ++\<^sub>f \<Gamma>') |\<union>| C
2. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
3. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
4. \<And>x. \<lbrakk>\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis; \<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> x \<and> related_v x ml_rhs'\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (4 subgoals):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (\<Gamma> ++\<^sub>f \<Gamma>') |\<union>| C
2. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
3. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
4. \<And>x. \<lbrakk>\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis; \<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> x \<and> related_v x ml_rhs'\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have "consts (Sabs cs) |\<subseteq>| fmdom \<Gamma> |\<union>| C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. consts (Sabs cs) |\<subseteq>| fmdom \<Gamma> |\<union>| C
[PROOF STEP]
using mat1
[PROOF STATE]
proof (prove)
using this:
cupcake_evaluate_single env ml_scr (Rval ml_scr')
cupcake_match_result (sem_env.c env) ml_scr' ml_cs Bindv = Rval (ml_rhs, ml_pat, env')
cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) ml_rhs ml_res
\<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env)); related_exp ?t4 ml_scr; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) (Rval ml_scr')
\<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp ?t4 ml_rhs; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) ml_res
is_cupcake_all_env env
fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp t (Mat ml_scr ml_cs)
pre_strong_term_class.wellformed t
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except t (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts t
not_shadows_vconsts_env \<Gamma>
goal (1 subgoal):
1. consts (Sabs cs) |\<subseteq>| fmdom \<Gamma> |\<union>| C
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
using this:
cupcake_evaluate_single env ml_scr (Rval ml_scr')
cupcake_match_result (sem_env.c env) ml_scr' ml_cs Bindv = Rval (ml_rhs, ml_pat, env')
cupcake_evaluate_single (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env) ml_rhs ml_res
\<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v env)); related_exp ?t4 ml_scr; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) (Rval ml_scr')
\<lbrakk>is_cupcake_all_env (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env); fmrel_on_fset (ids ?t4) related_v ?\<Gamma>4 (fmap_of_ns (sem_env.v (update_v (\<lambda>_. nsAppend (alist_to_ns env') (sem_env.v env)) env))); related_exp ?t4 ml_rhs; pre_strong_term_class.wellformed ?t4; wellformed_venv ?\<Gamma>4; closed_venv ?\<Gamma>4; closed_except ?t4 (fmdom ?\<Gamma>4); fmpred (\<lambda>_. vwelldefined') ?\<Gamma>4; consts ?t4 |\<subseteq>| fmdom ?\<Gamma>4 |\<union>| C; fdisjnt C (fmdom ?\<Gamma>4); \<not> shadows_consts ?t4; not_shadows_vconsts_env ?\<Gamma>4\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. ?\<Gamma>4 \<turnstile>\<^sub>v ?t4 \<down> v \<and> related_v v ml_v) ml_res
is_cupcake_all_env env
fmrel_on_fset (ids (Sabs cs $\<^sub>s scr)) related_v \<Gamma> (fmap_of_ns (sem_env.v env))
related_exp (Sabs cs $\<^sub>s scr) (Mat ml_scr ml_cs)
pre_strong_term_class.wellformed (Sabs cs $\<^sub>s scr)
wellformed_venv \<Gamma>
closed_venv \<Gamma>
closed_except (Sabs cs $\<^sub>s scr) (fmdom \<Gamma>)
fmpred (\<lambda>_. vwelldefined') \<Gamma>
consts (Sabs cs $\<^sub>s scr) |\<subseteq>| fmdom \<Gamma> |\<union>| C
fdisjnt C (fmdom \<Gamma>)
\<not> shadows_consts (Sabs cs $\<^sub>s scr)
not_shadows_vconsts_env \<Gamma>
goal (1 subgoal):
1. consts (Sabs cs) |\<subseteq>| fmdom \<Gamma> |\<union>| C
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
consts (Sabs cs) |\<subseteq>| fmdom \<Gamma> |\<union>| C
goal (4 subgoals):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> consts rhs |\<subseteq>| fmdom (\<Gamma> ++\<^sub>f \<Gamma>') |\<union>| C
2. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
3. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
4. \<And>x. \<lbrakk>\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis; \<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> x \<and> related_v x ml_rhs'\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show "consts rhs |\<subseteq>| fmdom (\<Gamma> ++\<^sub>f \<Gamma>') |\<union>| C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. consts rhs |\<subseteq>| fmdom (\<Gamma> ++\<^sub>f \<Gamma>') |\<union>| C
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. consts rhs |\<subseteq>| fmdom \<Gamma> |\<union>| fmdom \<Gamma>' |\<union>| C
[PROOF STEP]
unfolding \<open>fmdom \<Gamma>' = frees pat\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. consts rhs |\<subseteq>| fmdom \<Gamma> |\<union>| frees pat |\<union>| C
[PROOF STEP]
using \<open>(pat, rhs) \<in> set cs\<close> \<open>consts (Sabs cs) |\<subseteq>| _\<close>
[PROOF STATE]
proof (prove)
using this:
(pat, rhs) \<in> set cs
consts (Sabs cs) |\<subseteq>| fmdom \<Gamma> |\<union>| C
goal (1 subgoal):
1. consts rhs |\<subseteq>| fmdom \<Gamma> |\<union>| frees pat |\<union>| C
[PROOF STEP]
unfolding sconsts_sabs
[PROOF STATE]
proof (prove)
using this:
(pat, rhs) \<in> set cs
list_all (\<lambda>(uu_, t). consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C) cs
goal (1 subgoal):
1. consts rhs |\<subseteq>| fmdom \<Gamma> |\<union>| frees pat |\<union>| C
[PROOF STEP]
by (auto simp: list_all_iff)
[PROOF STATE]
proof (state)
this:
consts rhs |\<subseteq>| fmdom (\<Gamma> ++\<^sub>f \<Gamma>') |\<union>| C
goal (3 subgoals):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
2. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
3. \<And>x. \<lbrakk>\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis; \<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> x \<and> related_v x ml_rhs'\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
2. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
3. \<And>x. \<lbrakk>\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis; \<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> x \<and> related_v x ml_rhs'\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have "fdisjnt C (fmdom \<Gamma>')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fdisjnt C (fmdom \<Gamma>')
[PROOF STEP]
unfolding \<open>fmdom \<Gamma>' = frees pat\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. fdisjnt C (frees pat)
[PROOF STEP]
using \<open>\<not> shadows_consts t\<close> \<open>(pat, rhs) \<in> set cs\<close>
[PROOF STATE]
proof (prove)
using this:
\<not> shadows_consts t
(pat, rhs) \<in> set cs
goal (1 subgoal):
1. fdisjnt C (frees pat)
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
using this:
\<not> shadows_consts (Sabs cs $\<^sub>s scr)
(pat, rhs) \<in> set cs
goal (1 subgoal):
1. fdisjnt C (frees pat)
[PROOF STEP]
by (auto simp: list_ex_iff fdisjnt_alt_def all_consts_def)
[PROOF STATE]
proof (state)
this:
fdisjnt C (fmdom \<Gamma>')
goal (3 subgoals):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> fdisjnt C (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
2. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
3. \<And>x. \<lbrakk>\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis; \<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> x \<and> related_v x ml_rhs'\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
thus "fdisjnt C (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))"
[PROOF STATE]
proof (prove)
using this:
fdisjnt C (fmdom \<Gamma>')
goal (1 subgoal):
1. fdisjnt C (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
[PROOF STEP]
using \<open>fdisjnt C (fmdom \<Gamma>)\<close>
[PROOF STATE]
proof (prove)
using this:
fdisjnt C (fmdom \<Gamma>')
fdisjnt C (fmdom \<Gamma>)
goal (1 subgoal):
1. fdisjnt C (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
[PROOF STEP]
unfolding fdisjnt_alt_def
[PROOF STATE]
proof (prove)
using this:
C |\<inter>| fmdom \<Gamma>' = {||}
C |\<inter>| fmdom \<Gamma> = {||}
goal (1 subgoal):
1. C |\<inter>| fmdom (\<Gamma> ++\<^sub>f \<Gamma>') = {||}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
fdisjnt C (fmdom (\<Gamma> ++\<^sub>f \<Gamma>'))
goal (2 subgoals):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
2. \<And>x. \<lbrakk>\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis; \<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> x \<and> related_v x ml_rhs'\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. (\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<not> shadows_consts rhs
2. \<And>x. \<lbrakk>\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis; \<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> x \<and> related_v x ml_rhs'\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show "\<not> shadows_consts rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<not> shadows_consts rhs
[PROOF STEP]
using \<open>(pat, rhs) \<in> set cs\<close> \<open>\<not> shadows_consts t\<close>
[PROOF STATE]
proof (prove)
using this:
(pat, rhs) \<in> set cs
\<not> shadows_consts t
goal (1 subgoal):
1. \<not> shadows_consts rhs
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
using this:
(pat, rhs) \<in> set cs
\<not> shadows_consts (Sabs cs $\<^sub>s scr)
goal (1 subgoal):
1. \<not> shadows_consts rhs
[PROOF STEP]
by (auto simp: list_ex_iff)
[PROOF STATE]
proof (state)
this:
\<not> shadows_consts rhs
goal (1 subgoal):
1. \<And>x. \<lbrakk>\<And>rhs'. \<lbrakk>\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'; related_v rhs' ml_rhs'\<rbrakk> \<Longrightarrow> thesis; \<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> x \<and> related_v x ml_rhs'\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
qed blast
[PROOF STATE]
proof (state)
this:
\<Gamma> ++\<^sub>f \<Gamma>' \<turnstile>\<^sub>v rhs \<down> rhs'
related_v rhs' ml_rhs'
goal (1 subgoal):
1. \<And>v. ml_res = Rval v \<Longrightarrow> \<exists>va. \<Gamma> \<turnstile>\<^sub>v t \<down> va \<and> related_v va v
[PROOF STEP]
show "\<exists>t'. \<Gamma> \<turnstile>\<^sub>v t \<down> t' \<and> related_v t' ml_rhs'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<exists>t'. \<Gamma> \<turnstile>\<^sub>v t \<down> t' \<and> related_v t' ml_rhs'
[PROOF STEP]
unfolding \<open>t = _\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<exists>t'. \<Gamma> \<turnstile>\<^sub>v Sabs cs $\<^sub>s scr \<down> t' \<and> related_v t' ml_rhs'
[PROOF STEP]
apply (intro exI conjI seval.intros)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<Gamma> \<turnstile>\<^sub>v Sabs cs $\<^sub>s scr \<down> ?t'
2. related_v ?t' ml_rhs'
[PROOF STEP]
apply (rule veval'.intros)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
1. \<Gamma> \<turnstile>\<^sub>v Sabs cs \<down> Vabs ?cs2 ?\<Gamma>'2
2. \<Gamma> \<turnstile>\<^sub>v scr \<down> ?u'2
3. vfind_match ?cs2 ?u'2 = Some (?env2, ?uu2, ?rhs2)
4. ?\<Gamma>'2 ++\<^sub>f ?env2 \<turnstile>\<^sub>v ?rhs2 \<down> ?t'
5. related_v ?t' ml_rhs'
[PROOF STEP]
apply (rule veval'.intros)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
1. \<Gamma> \<turnstile>\<^sub>v scr \<down> ?u'2
2. vfind_match cs ?u'2 = Some (?env2, ?uu2, ?rhs2)
3. \<Gamma> ++\<^sub>f ?env2 \<turnstile>\<^sub>v ?rhs2 \<down> ?t'
4. related_v ?t' ml_rhs'
[PROOF STEP]
apply fact+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
\<exists>t'. \<Gamma> \<turnstile>\<^sub>v t \<down> t' \<and> related_v t' ml_rhs'
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) ml_res
goal (7 subgoals):
1. \<And>env cn es \<Gamma> t. \<lbrakk>\<not> do_con_check (sem_env.c env) cn (length es); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
2. \<And>env cn es rs err \<Gamma> t. \<lbrakk>do_con_check (sem_env.c env) cn (length es); list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Con cn es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
3. \<And>env n \<Gamma> t. \<lbrakk>nsLookup (sem_env.v env) n = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Var n); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
4. \<And>env es rs vs \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rval vs; do_opapp (rev vs) = None; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App Opapp es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr (Rabort Rtype_error))
5. \<And>env es rs err op0 \<Gamma> t. \<lbrakk>list_all2_shortcircuit (\<lambda>x1 x2. cupcake_evaluate_single env x1 x2 \<and> (is_cupcake_all_env env \<longrightarrow> (\<forall>x xa. fmrel_on_fset (ids xa) related_v x (fmap_of_ns (sem_env.v env)) \<longrightarrow> related_exp xa x1 \<longrightarrow> pre_strong_term_class.wellformed xa \<longrightarrow> wellformed_venv x \<longrightarrow> closed_venv x \<longrightarrow> closed_except xa (fmdom x) \<longrightarrow> fmpred (\<lambda>_. vwelldefined') x \<longrightarrow> consts xa |\<subseteq>| fmdom x |\<union>| C \<longrightarrow> fdisjnt C (fmdom x) \<longrightarrow> \<not> shadows_consts xa \<longrightarrow> not_shadows_vconsts_env x \<longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. x \<turnstile>\<^sub>v xa \<down> v \<and> related_v v ml_v) x2))) (rev es) rs; sequence_result rs = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (exp0.App op0 es); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
6. \<And>env e v0 pes err \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rval v0); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rval v0); cupcake_match_result (sem_env.c env) v0 pes Bindv = Rerr err; is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
7. \<And>env e err pes \<Gamma> t. \<lbrakk>cupcake_evaluate_single env e (Rerr err); \<And>\<Gamma> t. \<lbrakk>is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t e; pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err); is_cupcake_all_env env; fmrel_on_fset (ids t) related_v \<Gamma> (fmap_of_ns (sem_env.v env)); related_exp t (Mat e pes); pre_strong_term_class.wellformed t; wellformed_venv \<Gamma>; closed_venv \<Gamma>; closed_except t (fmdom \<Gamma>); fmpred (\<lambda>_. vwelldefined') \<Gamma>; consts t |\<subseteq>| fmdom \<Gamma> |\<union>| C; fdisjnt C (fmdom \<Gamma>); \<not> shadows_consts t; not_shadows_vconsts_env \<Gamma>\<rbrakk> \<Longrightarrow> if_rval (\<lambda>ml_v. \<exists>v. \<Gamma> \<turnstile>\<^sub>v t \<down> v \<and> related_v v ml_v) (Rerr err)
[PROOF STEP]
qed auto |
module extensible_records
import Data.List
import list
-- All functions must be total
%default total
-- All definitions and functions are exported
%access public export
-- *** Labelled Heterogeneous List ***
infixr 4 .=.
data Field : lty -> Type -> Type where
(.=.) : (l : lty) -> (v : t) -> Field l t
infix 5 :>
data LHList : List (lty, Type) -> Type where
HNil : LHList []
(:>) : Field lty t -> LHList ts -> LHList ((lty, t) :: ts)
infixr 3 :++:
-- Appends two labelled hlists
(:++:) : LHList ts -> LHList us -> LHList (ts ++ us)
(:++:) HNil ys = ys
(:++:) (x :> xs) ys = x :> (xs :++: ys)
-- *** Record ***
data Record : List (lty, Type) -> Type where
MkRecord : IsSet (labelsOf ts) -> LHList ts ->
Record ts
recToHList : Record ts -> LHList ts
recToHList (MkRecord _ hs) = hs
recLblIsSet : Record ts -> IsSet (labelsOf ts)
recLblIsSet (MkRecord isS _) = isS
emptyRec : Record []
emptyRec = MkRecord IsSetNil {ts=[]} HNil
hListToRec : DecEq lty => {prf : IsSet (labelsOf ts)} -> LHList ts -> Record ts
hListToRec {prf} hs = MkRecord prf hs
-- *** Automatic generation of proofs ***
TypeOrUnit : Dec p -> (p -> Type) -> Type
TypeOrUnit (Yes yes) tyCons = tyCons yes
TypeOrUnit (No _) _ = ()
mkTorU : (d : Dec p) -> (tyCons : p -> Type) ->
(f : (prf : p) -> tyCons prf) ->
TypeOrUnit d tyCons
mkTorU (Yes yes) _ f = f yes
mkTorU (No _) _ _ = ()
UnitOrType : Dec p -> (Not p -> Type) -> Type
UnitOrType (Yes _) _ = ()
UnitOrType (No no) tyCons = tyCons no
mkUorT : (d : Dec p) -> (tyCons : Not p -> Type) ->
(f : (contra : Not p) -> tyCons contra) ->
UnitOrType d tyCons
mkUorT (Yes _) _ _ = ()
mkUorT (No no) _ f = f no
-- TypeOrUnit with constant return type
TypeOrUnitC : Dec p -> Type -> Type
TypeOrUnitC d ty = TypeOrUnit d (\_ => ty)
mkTorUC : (d : Dec p) -> (f : p -> ty)
-> TypeOrUnitC d ty
mkTorUC {ty} d f = mkTorU d (\_ => ty)
(\p => f p)
-- UnitOrType with constant return type
UnitOrTypeC : Dec p -> Type -> Type
UnitOrTypeC d ty = UnitOrType d (\_ => ty)
mkUorTC : (d : Dec p) -> (f : Not p -> ty)
-> UnitOrTypeC d ty
mkUorTC {ty} d f = mkUorT d (\_ => ty)
(\np => f np)
-- *** Extension of record ***
consR : DecEq lty => {l : lty} ->
Field l t -> Record ts ->
Not (Elem l (labelsOf ts)) ->
Record ((l, t) :: ts)
consR {ts} f (MkRecord isS fs) notLInTs =
MkRecord (IsSetCons notLInTs isS) (f :> fs)
MaybeE : DecEq lty => lty -> List (lty, Type) -> Type -> Type
MaybeE l ts r = UnitOrTypeC (isElem l (labelsOf ts)) r
infixr 6 .*.
(.*.) : DecEq lty => {l : lty} ->
Field l t -> Record ts ->
MaybeE l ts (Record ((l, t) :: ts))
(.*.) {l} {ts} f r
= mkUorTC (isElem l (labelsOf ts))
(\notp => consR f r notp)
-- *** Lookup ***
getType : (ts : List (lty, Type)) -> Elem l (labelsOf ts) ->
Type
getType ((l, ty) :: ts) Here = ty
getType ((l, ty) :: ts)(There th) = getType ts th
lookupH : (l : lty) -> LHList ts ->
(isE : Elem l (labelsOf ts)) -> getType ts isE
lookupH _ ((_ .=. v) :> _) Here = v
lookupH l (_ :> hs) (There th) = lookupH l hs th
lookupR : (l : lty) -> Record ts ->
(isE : Elem l (labelsOf ts)) -> getType ts isE
lookupR l (MkRecord _ fs) isE = lookupH l fs isE
MaybeLkp : DecEq lty => List (lty, Type) -> lty -> Type
MaybeLkp ts l = TypeOrUnit (isElem l (labelsOf ts))
(\isE => getType ts isE)
infixr 7 .!.
(.!.) : DecEq lty => Record ts -> (l : lty) ->
MaybeLkp ts l
(.!.) {ts} r l = mkTorU (isElem l (labelsOf ts))
(\isE => getType ts isE)
(\isE => lookupR l r isE)
-- *** Update ***
updateH : DecEq lty => (l : lty) ->
(isE : Elem l (labelsOf ts)) ->
getType ts isE -> LHList ts -> LHList ts
updateH l {ts=(l,_)::ts} Here v ( _ :> fs) = (l .=. v) :> fs
updateH l {ts=(_,_)::ts} (There th) v (f :> fs) = f :> updateH l th v fs
updateR : DecEq lty => (l : lty) ->
(isE : Elem l (labelsOf ts)) ->
getType ts isE -> Record ts -> Record ts
updateR l isE v (MkRecord isS fs) = MkRecord isS (updateH l isE v fs)
MaybeUpd : DecEq lty => List (lty, Type) -> lty -> Type
MaybeUpd ts l = TypeOrUnit (isElem l (labelsOf ts))
(\isE => getType ts isE -> Record ts)
updR : DecEq lty => (l : lty) -> Record ts -> MaybeUpd ts l
updR {ts} l r =
mkTorU (isElem l (labelsOf ts))
(\isE => getType ts isE -> Record ts)
(\isE => \v => updateR l isE v r)
-- *** Append ***
appendR : DecEq lty => {ts, us : List (lty, Type)} ->
Record ts -> Record us ->
IsSet (labelsOf (ts ++ us)) -> Record (ts ++ us)
appendR (MkRecord _ fs) (MkRecord _ gs) iS = MkRecord iS (fs :++: gs)
MaybeApp : DecEq lty => List (lty, Type) ->
List (lty, Type) -> Type -> Type
MaybeApp ts us r =
TypeOrUnitC (isSet (labelsOf (ts ++ us))) r
infixr 7 .++.
(.++.) : DecEq lty => {ts, us : List (lty, Type)} -> Record ts ->
Record us -> MaybeApp ts us (Record (ts ++ us))
(.++.) {ts} {us} rt ru =
mkTorUC (isSet (labelsOf (ts ++ us)))
(\p => appendR rt ru p)
-- *** Delete ***
hDeleteH : DecEq lty => {ts : List (lty, Type)} -> (l : lty) -> LHList ts -> LHList (l ://: ts)
hDeleteH {ts=[]} _ _ = HNil
hDeleteH {ts=(l', ty)::ts} l (f :> fs) with (decEq l l')
hDeleteH {ts=(l', ty)::ts} l (f :> fs) | Yes _ = fs
hDeleteH {ts=(l', ty)::ts} l (f :> fs) | No _ = f :> hDeleteH l fs
infixr 7 .//.
(.//.) : DecEq lty => {ts : List (lty, Type)} -> (l : lty) -> Record ts ->
Record (l ://: ts)
(.//.) l (MkRecord isS fs) =
let newFs = hDeleteH l fs
newIsS = ifDeleteThenIsSet l isS
in MkRecord newIsS newFs
-- *** Delete Labels ***
hDeleteLabelsH : DecEq lty => {ts : List (lty, Type)} -> (ls : List lty ) -> LHList ts -> LHList (ls :///: ts)
hDeleteLabelsH [] fs = fs
hDeleteLabelsH (l :: ls) fs = hDeleteH l $ hDeleteLabelsH ls fs
infixr 7 .///.
(.///.) : DecEq lty => {ts : List (lty, Type)} -> (ls : List lty) -> Record ts ->
Record (ls :///: ts)
(.///.) ls (MkRecord isS fs) =
let newFs = hDeleteLabelsH ls fs
newIsS = ifDeleteLabelsThenIsSet ls isS
in MkRecord newIsS newFs
-- *** Left Union ***
hLeftUnionH : DecEq lty => {ts, us : List (lty, Type)} ->
LHList ts -> LHList us ->
LHList (ts :||: us)
hLeftUnionH {ts} fs gs = fs :++: (hDeleteLabelsH (labelsOf ts) gs)
infixr 7 .||.
(.||.) : DecEq lty => {ts, us : List (lty, Type)} -> Record ts -> Record us ->
Record (ts :||: us)
(.||.) (MkRecord isS1 fs) (MkRecord isS2 gs) =
let newFs = hLeftUnionH fs gs
newIsS = ifLeftUnionThenisSet isS1 isS2
in MkRecord newIsS newFs
-- *** Left Projection ***
projectLeftH : DecEq lty => {ts : List (lty, Type)} -> (ls : List lty) ->
LHList ts -> LHList (ls :<: ts)
projectLeftH {ts=[]} _ HNil = HNil
projectLeftH {ts=(l, _) :: _} ls fs with (isElem l ls)
projectLeftH {ts=(l, _) :: _} ls (f :> fs) | Yes _ = f :> projectLeftH ls fs
projectLeftH {ts=(l, _) :: _} ls (_ :> fs) | No _ = projectLeftH ls fs
infixr 7 .<.
(.<.) : DecEq lty => {ts : List (lty, Type)} -> (ls : List lty) ->
Record ts -> Record (ls :<: ts)
(.<.) ls (MkRecord isS fs) =
let newFs = projectLeftH ls fs
newIsS = ifProjectLeftThenIsSet ls isS
in MkRecord newIsS newFs
-- *** Right Projection ***
projectRightH : DecEq lty => {ts : List (lty, Type)} -> (ls : List lty) ->
LHList ts -> LHList (ls :>: ts)
projectRightH {ts=[]} _ HNil = HNil
projectRightH {ts=(l, _) :: _} ls fs with (isElem l ls)
projectRightH {ts=(l, _) :: _} ls (_ :> fs) | Yes _ = projectRightH ls fs
projectRightH {ts=(l, _) :: _} ls (f :> fs) | No _ = f :> projectRightH ls fs
infixr 7 .>.
(.>.) : DecEq lty => {ts : List (lty, Type)} -> (ls : List lty) ->
Record ts -> Record (ls :>: ts)
(.>.) ls (MkRecord isS fs) =
let newFs = projectRightH ls fs
newIsS = ifProjectRightThenIsSet ls isS
in MkRecord newIsS newFs
|
#include <boost/foreach.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/iter_find.hpp>
#include <list>
#include "spiral/protocols/basic/LineOnlyReceiver.h"
namespace spiral {
namespace protocols {
namespace basic {
void LineOnlyReceiver::dataReceived(const char *data, size_t size)
{
buffer_.append(string(data, size));
std::list<std::string> lines;
boost::iter_split(lines, buffer_, boost::first_finder(delimiter_));
if (!lines.back().empty())
{
// no newline at end, keep the remaining data
if (lines.size()<2) // optimization
return;
buffer_=lines.back();
}
else
// newline at end
buffer_.clear();
// remove last newline/remaining data
lines.pop_back();
BOOST_FOREACH(std::string token, lines)
{
if (transport().disconnecting())
return;
if (token.length() > MAX_LENGTH)
{
lineLengthExceeded(token);
return;
}
else if (!token.empty())
lineReceived(token);
}
if (buffer_.length() > MAX_LENGTH)
{
lineLengthExceeded(buffer_);
return;
}
}
void LineOnlyReceiver::sendLine(const string &data)
{
string s(data);
s.append(delimiter_);
transport().write(s.c_str(), s.length());
}
}}} // spiral::protocols::basic
|
(*<*)
(*
* The worker/wrapper transformation, following Gill and Hutton.
* (C)opyright 2009-2011, Peter Gammie, peteg42 at gmail.com.
* License: BSD
*)
theory Backtracking
imports
HOLCF
Nats
WorkerWrapperNew
begin
(*>*)
section\<open>Backtracking using lazy lists and continuations\<close>
text\<open>
\label{sec:ww-backtracking}
To illustrate the utility of worker/wrapper fusion to programming
language semantics, we consider here the first-order part of a
higher-order backtracking language by \<^citet>\<open>"DBLP:conf/icfp/WandV04"\<close>;
see also \<^citet>\<open>"DBLP:journals/ngc/DanvyGR01"\<close>. We refer the reader to
these papers for a broader motivation for these languages.
As syntax is typically considered to be inductively generated, with
each syntactic object taken to be finite and completely defined, we
define the syntax for our language using a HOL datatype:
\<close>
datatype expr = const nat | add expr expr | disj expr expr | fail
(*<*)
lemma case_expr_cont[cont2cont]:
assumes f1: "\<And>y. cont (\<lambda>x. f1 x y)"
assumes f2: "\<And>y z. cont (\<lambda>x. f2 x y z)"
assumes f3: "\<And>y z. cont (\<lambda>x. f3 x y z)"
assumes f4: "cont (\<lambda>x. f4 x)"
shows "cont (\<lambda>x. case_expr (f1 x) (f2 x) (f3 x) (f4 x) expr)"
using assms by (cases expr) simp_all
(* Presumably obsolete in the HG version, not so in Isabelle2011. *)
fun
expr_encode :: "expr \<Rightarrow> nat"
where
"expr_encode (const n) = prod_encode (0, n)"
| "expr_encode (add e1 e2) = prod_encode (1, (prod_encode (expr_encode e1, expr_encode e2)))"
| "expr_encode (disj e1 e2) = prod_encode (2, (prod_encode (expr_encode e1, expr_encode e2)))"
| "expr_encode fail = prod_encode (3, 0)"
lemma expr_encode_inj:
"expr_encode x = expr_encode y \<Longrightarrow> x = y"
by (induct x arbitrary: y) ((case_tac y, auto dest!: inj_onD[OF inj_prod_encode, where A=UNIV])[1])+
instance expr :: countable
by (rule countable_classI[OF expr_encode_inj])
(*>*)
text\<open>
The language consists of constants, an addition function, a
disjunctive choice between expressions, and failure. We give it a
direct semantics using the monad of lazy lists of natural numbers,
with the goal of deriving an an extensionally-equivalent evaluator
that uses double-barrelled continuations.
Our theory of lazy lists is entirely standard.
\<close>
default_sort predomain
domain 'a llist =
lnil
| lcons (lazy "'a") (lazy "'a llist")
text\<open>
By relaxing the default sort of type variables to \<open>predomain\<close>,
our polymorphic definitions can be used at concrete types that do not
contain @{term "\<bottom>"}. These include those constructed from HOL types
using the discrete ordering type constructor @{typ "'a discr"}, and in
particular our interpretation @{typ "nat discr"} of the natural
numbers.
The following standard list functions underpin the monadic
infrastructure:
\<close>
fixrec lappend :: "'a llist \<rightarrow> 'a llist \<rightarrow> 'a llist" where
"lappend\<cdot>lnil\<cdot>ys = ys"
| "lappend\<cdot>(lcons\<cdot>x\<cdot>xs)\<cdot>ys = lcons\<cdot>x\<cdot>(lappend\<cdot>xs\<cdot>ys)"
fixrec lconcat :: "'a llist llist \<rightarrow> 'a llist" where
"lconcat\<cdot>lnil = lnil"
| "lconcat\<cdot>(lcons\<cdot>x\<cdot>xs) = lappend\<cdot>x\<cdot>(lconcat\<cdot>xs)"
fixrec lmap :: "('a \<rightarrow> 'b) \<rightarrow> 'a llist \<rightarrow> 'b llist" where
"lmap\<cdot>f\<cdot>lnil = lnil"
| "lmap\<cdot>f\<cdot>(lcons\<cdot>x\<cdot>xs) = lcons\<cdot>(f\<cdot>x)\<cdot>(lmap\<cdot>f\<cdot>xs)"
(*<*)
lemma lappend_strict'[simp]: "lappend\<cdot>\<bottom> = (\<Lambda> a. \<bottom>)"
by fixrec_simp
lemma lconcat_strict[simp]: "lconcat\<cdot>\<bottom> = \<bottom>"
by fixrec_simp
lemma lmap_strict[simp]: "lmap\<cdot>f\<cdot>\<bottom> = \<bottom>"
by fixrec_simp
(*>*)
text\<open>
We define the lazy list monad \<open>S\<close> in the traditional fashion:
\<close>
type_synonym S = "nat discr llist"
definition returnS :: "nat discr \<rightarrow> S" where
"returnS = (\<Lambda> x. lcons\<cdot>x\<cdot>lnil)"
definition bindS :: "S \<rightarrow> (nat discr \<rightarrow> S) \<rightarrow> S" where
"bindS = (\<Lambda> x g. lconcat\<cdot>(lmap\<cdot>g\<cdot>x))"
text\<open>
Unfortunately the lack of higher-order polymorphism in HOL prevents us
from providing the general typing one would expect a monad to have in
Haskell.
The evaluator uses the following extra constants:
\<close>
definition addS :: "S \<rightarrow> S \<rightarrow> S" where
"addS \<equiv> (\<Lambda> x y. bindS\<cdot>x\<cdot>(\<Lambda> xv. bindS\<cdot>y\<cdot>(\<Lambda> yv. returnS\<cdot>(xv + yv))))"
definition disjS :: "S \<rightarrow> S \<rightarrow> S" where
"disjS \<equiv> lappend"
definition failS :: "S" where
"failS \<equiv> lnil"
text\<open>
We interpret our language using these combinators in the obvious
way. The only complication is that, even though our evaluator is
primitive recursive, we must explicitly use the fixed point operator
as the worker/wrapper technique requires us to talk about the body of
the recursive definition.
\<close>
definition
evalS_body :: "(expr discr \<rightarrow> nat discr llist)
\<rightarrow> (expr discr \<rightarrow> nat discr llist)"
where
"evalS_body \<equiv> \<Lambda> r e. case undiscr e of
const n \<Rightarrow> returnS\<cdot>(Discr n)
| add e1 e2 \<Rightarrow> addS\<cdot>(r\<cdot>(Discr e1))\<cdot>(r\<cdot>(Discr e2))
| disj e1 e2 \<Rightarrow> disjS\<cdot>(r\<cdot>(Discr e1))\<cdot>(r\<cdot>(Discr e2))
| fail \<Rightarrow> failS"
abbreviation evalS :: "expr discr \<rightarrow> nat discr llist" where
"evalS \<equiv> fix\<cdot>evalS_body"
text\<open>
We aim to transform this evaluator into one using double-barrelled
continuations; one will serve as a "success" context, taking a natural
number into "the rest of the computation", and the other outright
failure.
In general we could work with an arbitrary observation type ala
\<^citet>\<open>"DBLP:conf/icalp/Reynolds74"\<close>, but for convenience we use the
clearly adequate concrete type @{typ "nat discr llist"}.
\<close>
type_synonym Obs = "nat discr llist"
type_synonym Failure = "Obs"
type_synonym Success = "nat discr \<rightarrow> Failure \<rightarrow> Obs"
type_synonym K = "Success \<rightarrow> Failure \<rightarrow> Obs"
text\<open>
To ease our development we adopt what
\<^citet>\<open>\<open>\S5\<close> in "DBLP:conf/icfp/WandV04"\<close> call a "failure computation"
instead of a failure continuation, which would have the type @{typ
"unit \<rightarrow> Obs"}.
The monad over the continuation type @{typ "K"} is as follows:
\<close>
definition returnK :: "nat discr \<rightarrow> K" where
"returnK \<equiv> (\<Lambda> x. \<Lambda> s f. s\<cdot>x\<cdot>f)"
definition bindK :: "K \<rightarrow> (nat discr \<rightarrow> K) \<rightarrow> K" where
"bindK \<equiv> \<Lambda> x g. \<Lambda> s f. x\<cdot>(\<Lambda> xv f'. g\<cdot>xv\<cdot>s\<cdot>f')\<cdot>f"
text\<open>
Our extra constants are defined as follows:
\<close>
definition addK :: "K \<rightarrow> K \<rightarrow> K" where
"addK \<equiv> (\<Lambda> x y. bindK\<cdot>x\<cdot>(\<Lambda> xv. bindK\<cdot>y\<cdot>(\<Lambda> yv. returnK\<cdot>(xv + yv))))"
definition disjK :: "K \<rightarrow> K \<rightarrow> K" where
"disjK \<equiv> (\<Lambda> g h. \<Lambda> s f. g\<cdot>s\<cdot>(h\<cdot>s\<cdot>f))"
definition failK :: "K" where
"failK \<equiv> \<Lambda> s f. f"
text\<open>
The continuation semantics is again straightforward:
\<close>
definition
evalK_body :: "(expr discr \<rightarrow> K) \<rightarrow> (expr discr \<rightarrow> K)"
where
"evalK_body \<equiv> \<Lambda> r e. case undiscr e of
const n \<Rightarrow> returnK\<cdot>(Discr n)
| add e1 e2 \<Rightarrow> addK\<cdot>(r\<cdot>(Discr e1))\<cdot>(r\<cdot>(Discr e2))
| disj e1 e2 \<Rightarrow> disjK\<cdot>(r\<cdot>(Discr e1))\<cdot>(r\<cdot>(Discr e2))
| fail \<Rightarrow> failK"
abbreviation evalK :: "expr discr \<rightarrow> K" where
"evalK \<equiv> fix\<cdot>evalK_body"
text\<open>
We now set up a worker/wrapper relation between these two semantics.
The kernel of @{term "unwrap"} is the following function that converts
a lazy list into an equivalent continuation representation.
\<close>
fixrec SK :: "S \<rightarrow> K" where
"SK\<cdot>lnil = failK"
| "SK\<cdot>(lcons\<cdot>x\<cdot>xs) = (\<Lambda> s f. s\<cdot>x\<cdot>(SK\<cdot>xs\<cdot>s\<cdot>f))"
definition
unwrap :: "(expr discr \<rightarrow> nat discr llist) \<rightarrow> (expr discr \<rightarrow> K)"
where
"unwrap \<equiv> \<Lambda> r e. SK\<cdot>(r\<cdot>e)"
(*<*)
lemma SK_strict[simp]: "SK\<cdot>\<bottom> = \<bottom>"
by fixrec_simp
lemma unwrap_strict[simp]: "unwrap\<cdot>\<bottom> = \<bottom>"
unfolding unwrap_def by simp
(*>*)
text\<open>
Symmetrically @{term "wrap"} converts an evaluator using continuations
into one generating lazy lists by passing it the right continuations.
\<close>
definition KS :: "K \<rightarrow> S" where
"KS \<equiv> (\<Lambda> k. k\<cdot>lcons\<cdot>lnil)"
definition wrap :: "(expr discr \<rightarrow> K) \<rightarrow> (expr discr \<rightarrow> nat discr llist)" where
"wrap \<equiv> \<Lambda> r e. KS\<cdot>(r\<cdot>e)"
(*<*)
lemma KS_strict[simp]: "KS\<cdot>\<bottom> = \<bottom>"
unfolding KS_def by simp
lemma wrap_strict[simp]: "wrap\<cdot>\<bottom> = \<bottom>"
unfolding wrap_def by simp
(*>*)
text\<open>
The worker/wrapper condition follows directly from these definitions.
\<close>
lemma KS_SK_id:
"KS\<cdot>(SK\<cdot>xs) = xs"
by (induct xs) (simp_all add: KS_def failK_def)
lemma wrap_unwrap_id:
"wrap oo unwrap = ID"
unfolding wrap_def unwrap_def
by (simp add: KS_SK_id cfun_eq_iff)
text\<open>
The worker/wrapper transformation is only non-trivial if @{term
"wrap"} and @{term "unwrap"} do not witness an isomorphism. In this
case we can show that we do not even have a Galois connection.
\<close>
lemma cfun_not_below:
"f\<cdot>x \<notsqsubseteq> g\<cdot>x \<Longrightarrow> f \<notsqsubseteq> g"
by (auto simp: cfun_below_iff)
lemma unwrap_wrap_not_under_id:
"unwrap oo wrap \<notsqsubseteq> ID"
proof -
let ?witness = "\<Lambda> e. (\<Lambda> s f. lnil :: K)"
have "(unwrap oo wrap)\<cdot>?witness\<cdot>(Discr fail)\<cdot>\<bottom>\<cdot>(lcons\<cdot>0\<cdot>lnil)
\<notsqsubseteq> ?witness\<cdot>(Discr fail)\<cdot>\<bottom>\<cdot>(lcons\<cdot>0\<cdot>lnil)"
by (simp add: failK_def wrap_def unwrap_def KS_def)
hence "(unwrap oo wrap)\<cdot>?witness \<notsqsubseteq> ?witness"
by (fastforce intro!: cfun_not_below)
thus ?thesis by (simp add: cfun_not_below)
qed
text\<open>
We now apply \texttt{worker\_wrapper\_id}:
\<close>
definition eval_work :: "expr discr \<rightarrow> K" where
"eval_work \<equiv> fix\<cdot>(unwrap oo evalS_body oo wrap)"
definition eval_ww :: "expr discr \<rightarrow> nat discr llist" where
"eval_ww \<equiv> wrap\<cdot>eval_work"
lemma "evalS = eval_ww"
unfolding eval_ww_def eval_work_def
using worker_wrapper_id[OF wrap_unwrap_id]
by simp
text\<open>
We now show how the monadic operations correspond by showing that
@{term "SK"} witnesses a \emph{monad morphism}
\<^citep>\<open>\<open>\S6\<close> in "wadler92:_comprehending_monads"\<close>. As required by
\<^citet>\<open>\<open>Definition~2.1\<close> in "DBLP:journals/ngc/DanvyGR01"\<close>, the mapping needs
to hold for our specific operations in addition to the common monadic
scaffolding.
\<close>
lemma SK_returnS_returnK:
"SK\<cdot>(returnS\<cdot>x) = returnK\<cdot>x"
by (simp add: returnS_def returnK_def failK_def)
lemma SK_lappend_distrib:
"SK\<cdot>(lappend\<cdot>xs\<cdot>ys)\<cdot>s\<cdot>f = SK\<cdot>xs\<cdot>s\<cdot>(SK\<cdot>ys\<cdot>s\<cdot>f)"
by (induct xs) (simp_all add: failK_def)
lemma SK_bindS_bindK:
"SK\<cdot>(bindS\<cdot>x\<cdot>g) = bindK\<cdot>(SK\<cdot>x)\<cdot>(SK oo g)"
by (induct x)
(simp_all add: cfun_eq_iff
bindS_def bindK_def failK_def
SK_lappend_distrib)
lemma SK_addS_distrib:
"SK\<cdot>(addS\<cdot>x\<cdot>y) = addK\<cdot>(SK\<cdot>x)\<cdot>(SK\<cdot>y)"
by (clarsimp simp: cfcomp1
addS_def addK_def failK_def
SK_bindS_bindK SK_returnS_returnK)
lemma SK_disjS_disjK:
"SK\<cdot>(disjS\<cdot>xs\<cdot>ys) = disjK\<cdot>(SK\<cdot>xs)\<cdot>(SK\<cdot>ys)"
by (simp add: cfun_eq_iff disjS_def disjK_def SK_lappend_distrib)
lemma SK_failS_failK:
"SK\<cdot>failS = failK"
unfolding failS_def by simp
text\<open>
These lemmas directly establish the precondition for our all-in-one
worker/wrapper and fusion rule:
\<close>
lemma evalS_body_evalK_body:
"unwrap oo evalS_body oo wrap = evalK_body oo unwrap oo wrap"
proof(intro cfun_eqI)
fix r e' s f
obtain e :: "expr"
where ee': "e' = Discr e" by (cases e')
have "(unwrap oo evalS_body oo wrap)\<cdot>r\<cdot>(Discr e)\<cdot>s\<cdot>f
= (evalK_body oo unwrap oo wrap)\<cdot>r\<cdot>(Discr e)\<cdot>s\<cdot>f"
by (cases e)
(simp_all add: evalS_body_def evalK_body_def unwrap_def
SK_returnS_returnK SK_addS_distrib
SK_disjS_disjK SK_failS_failK)
with ee' show "(unwrap oo evalS_body oo wrap)\<cdot>r\<cdot>e'\<cdot>s\<cdot>f
= (evalK_body oo unwrap oo wrap)\<cdot>r\<cdot>e'\<cdot>s\<cdot>f"
by simp
qed
theorem evalS_evalK:
"evalS = wrap\<cdot>evalK"
using worker_wrapper_fusion_new[OF wrap_unwrap_id unwrap_strict]
evalS_body_evalK_body
by simp
text\<open>
This proof can be considered an instance of the approach of
\<^citet>\<open>"DBLP:journals/jfp/HuttonJG10"\<close>, which uses the worker/wrapper
machinery to relate two algebras.
This result could be obtained by a structural induction over the
syntax of the language. However our goal here is to show how such a
transformation can be achieved by purely equational means; this has
the advantange that our proof can be locally extended, e.g. to the
full language of \<^citet>\<open>"DBLP:journals/ngc/DanvyGR01"\<close> simply by proving
extra equations. In contrast the higher-order language of
\<^citet>\<open>"DBLP:conf/icfp/WandV04"\<close> is beyond the reach of this approach.
\<close>
(*<*)
end
(*>*)
|
(* Title: HOL/Auth/n_flash_lemma_on_inv__90.thy
Author: Yongjian Li and Kaiqiang Duan, State Key Lab of Computer Science, Institute of Software, Chinese Academy of Sciences
Copyright 2016 State Key Lab of Computer Science, Institute of Software, Chinese Academy of Sciences
*)
header{*The n_flash Protocol Case Study*}
theory n_flash_lemma_on_inv__90 imports n_flash_base
begin
section{*All lemmas on causal relation between inv__90 and some rule r*}
lemma n_PI_Remote_GetVsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_PI_Remote_Get src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_PI_Remote_Get src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_PI_Remote_GetXVsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_PI_Remote_GetX src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_PI_Remote_GetX src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_NakVsinv__90:
assumes a1: "(\<exists> dst. dst\<le>N\<and>r=n_NI_Nak dst)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain dst where a1:"dst\<le>N\<and>r=n_NI_Nak dst" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(dst=p__Inv4)\<or>(dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(dst=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(dst~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_Get_Nak__part__0Vsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_Get_Nak__part__0 src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_Get_Nak__part__0 src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_Get_Nak__part__1Vsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_Get_Nak__part__1 src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_Get_Nak__part__1 src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_Get_Nak__part__2Vsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_Get_Nak__part__2 src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_Get_Nak__part__2 src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_Get_Get__part__0Vsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_Get_Get__part__0 src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_Get_Get__part__0 src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_Get_Get__part__1Vsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_Get_Get__part__1 src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_Get_Get__part__1 src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_Get_Put_HeadVsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_Get_Put_Head N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_Get_Put_Head N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_Get_PutVsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_Get_Put src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_Get_Put src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_Get_Put_DirtyVsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_Get_Put_Dirty src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_Get_Put_Dirty src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Remote_Get_NakVsinv__90:
assumes a1: "(\<exists> src dst. src\<le>N\<and>dst\<le>N\<and>src~=dst\<and>r=n_NI_Remote_Get_Nak src dst)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src dst where a1:"src\<le>N\<and>dst\<le>N\<and>src~=dst\<and>r=n_NI_Remote_Get_Nak src dst" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4\<and>dst~=p__Inv4)\<or>(src~=p__Inv4\<and>dst=p__Inv4)\<or>(src~=p__Inv4\<and>dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4\<and>dst~=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4\<and>dst=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4\<and>dst~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Remote_Get_Nak_HomeVsinv__90:
assumes a1: "(\<exists> dst. dst\<le>N\<and>r=n_NI_Remote_Get_Nak_Home dst)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain dst where a1:"dst\<le>N\<and>r=n_NI_Remote_Get_Nak_Home dst" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(dst=p__Inv4)\<or>(dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(dst=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(dst~=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Remote_Get_PutVsinv__90:
assumes a1: "(\<exists> src dst. src\<le>N\<and>dst\<le>N\<and>src~=dst\<and>r=n_NI_Remote_Get_Put src dst)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src dst where a1:"src\<le>N\<and>dst\<le>N\<and>src~=dst\<and>r=n_NI_Remote_Get_Put src dst" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4\<and>dst~=p__Inv4)\<or>(src~=p__Inv4\<and>dst=p__Inv4)\<or>(src~=p__Inv4\<and>dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4\<and>dst~=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4\<and>dst=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4\<and>dst~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Remote_Get_Put_HomeVsinv__90:
assumes a1: "(\<exists> dst. dst\<le>N\<and>r=n_NI_Remote_Get_Put_Home dst)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain dst where a1:"dst\<le>N\<and>r=n_NI_Remote_Get_Put_Home dst" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(dst=p__Inv4)\<or>(dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(dst=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(dst~=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_Nak__part__0Vsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_Nak__part__0 src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_Nak__part__0 src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_Nak__part__1Vsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_Nak__part__1 src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_Nak__part__1 src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_Nak__part__2Vsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_Nak__part__2 src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_Nak__part__2 src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_GetX__part__0Vsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_GetX__part__0 src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_GetX__part__0 src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_GetX__part__1Vsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_GetX__part__1 src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_GetX__part__1 src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P3 s"
apply (cut_tac a1 a2 b1, simp, rule_tac x="(neg (andForm (eqn (IVar (Field (Field (Ident ''Sta'') ''HomeUniMsg'') ''Cmd'')) (Const UNI_Get)) (eqn (IVar (Field (Field (Ident ''Sta'') ''Dir'') ''Pending'')) (Const false))))" in exI, auto) done
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_1Vsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_1 N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_1 N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_2Vsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_2 N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_2 N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_3Vsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_3 N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_3 N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_4Vsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_4 N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_4 N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_5Vsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_5 N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_5 N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_6Vsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_6 N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_6 N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_7__part__0Vsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_7__part__0 N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_7__part__0 N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_7__part__1Vsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_7__part__1 N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_7__part__1 N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_7_NODE_Get__part__0Vsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_7_NODE_Get__part__0 N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_7_NODE_Get__part__0 N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_7_NODE_Get__part__1Vsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_7_NODE_Get__part__1 N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_7_NODE_Get__part__1 N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_8_HomeVsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_8_Home N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_8_Home N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_8_Home_NODE_GetVsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_8_Home_NODE_Get N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_8_Home_NODE_Get N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_8Vsinv__90:
assumes a1: "(\<exists> src pp. src\<le>N\<and>pp\<le>N\<and>src~=pp\<and>r=n_NI_Local_GetX_PutX_8 N src pp)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src pp where a1:"src\<le>N\<and>pp\<le>N\<and>src~=pp\<and>r=n_NI_Local_GetX_PutX_8 N src pp" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4\<and>pp~=p__Inv4)\<or>(src~=p__Inv4\<and>pp=p__Inv4)\<or>(src~=p__Inv4\<and>pp~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4\<and>pp~=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4\<and>pp=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4\<and>pp~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_8_NODE_GetVsinv__90:
assumes a1: "(\<exists> src pp. src\<le>N\<and>pp\<le>N\<and>src~=pp\<and>r=n_NI_Local_GetX_PutX_8_NODE_Get N src pp)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src pp where a1:"src\<le>N\<and>pp\<le>N\<and>src~=pp\<and>r=n_NI_Local_GetX_PutX_8_NODE_Get N src pp" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4\<and>pp~=p__Inv4)\<or>(src~=p__Inv4\<and>pp=p__Inv4)\<or>(src~=p__Inv4\<and>pp~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4\<and>pp~=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4\<and>pp=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4\<and>pp~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_9__part__0Vsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_9__part__0 N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_9__part__0 N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_9__part__1Vsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_9__part__1 N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_9__part__1 N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_10_HomeVsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_10_Home N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_10_Home N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_10Vsinv__90:
assumes a1: "(\<exists> src pp. src\<le>N\<and>pp\<le>N\<and>src~=pp\<and>r=n_NI_Local_GetX_PutX_10 N src pp)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src pp where a1:"src\<le>N\<and>pp\<le>N\<and>src~=pp\<and>r=n_NI_Local_GetX_PutX_10 N src pp" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4\<and>pp~=p__Inv4)\<or>(src~=p__Inv4\<and>pp=p__Inv4)\<or>(src~=p__Inv4\<and>pp~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4\<and>pp~=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4\<and>pp=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4\<and>pp~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Local_GetX_PutX_11Vsinv__90:
assumes a1: "(\<exists> src. src\<le>N\<and>r=n_NI_Local_GetX_PutX_11 N src)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src where a1:"src\<le>N\<and>r=n_NI_Local_GetX_PutX_11 N src" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4)\<or>(src~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Remote_GetX_NakVsinv__90:
assumes a1: "(\<exists> src dst. src\<le>N\<and>dst\<le>N\<and>src~=dst\<and>r=n_NI_Remote_GetX_Nak src dst)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src dst where a1:"src\<le>N\<and>dst\<le>N\<and>src~=dst\<and>r=n_NI_Remote_GetX_Nak src dst" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4\<and>dst~=p__Inv4)\<or>(src~=p__Inv4\<and>dst=p__Inv4)\<or>(src~=p__Inv4\<and>dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4\<and>dst~=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4\<and>dst=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4\<and>dst~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Remote_GetX_Nak_HomeVsinv__90:
assumes a1: "(\<exists> dst. dst\<le>N\<and>r=n_NI_Remote_GetX_Nak_Home dst)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain dst where a1:"dst\<le>N\<and>r=n_NI_Remote_GetX_Nak_Home dst" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(dst=p__Inv4)\<or>(dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(dst=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(dst~=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Remote_GetX_PutXVsinv__90:
assumes a1: "(\<exists> src dst. src\<le>N\<and>dst\<le>N\<and>src~=dst\<and>r=n_NI_Remote_GetX_PutX src dst)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain src dst where a1:"src\<le>N\<and>dst\<le>N\<and>src~=dst\<and>r=n_NI_Remote_GetX_PutX src dst" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(src=p__Inv4\<and>dst~=p__Inv4)\<or>(src~=p__Inv4\<and>dst=p__Inv4)\<or>(src~=p__Inv4\<and>dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(src=p__Inv4\<and>dst~=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4\<and>dst=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(src~=p__Inv4\<and>dst~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Remote_GetX_PutX_HomeVsinv__90:
assumes a1: "(\<exists> dst. dst\<le>N\<and>r=n_NI_Remote_GetX_PutX_Home dst)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain dst where a1:"dst\<le>N\<and>r=n_NI_Remote_GetX_PutX_Home dst" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(dst=p__Inv4)\<or>(dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(dst=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(dst~=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Remote_PutVsinv__90:
assumes a1: "(\<exists> dst. dst\<le>N\<and>r=n_NI_Remote_Put dst)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain dst where a1:"dst\<le>N\<and>r=n_NI_Remote_Put dst" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(dst=p__Inv4)\<or>(dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(dst=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(dst~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_NI_Remote_PutXVsinv__90:
assumes a1: "(\<exists> dst. dst\<le>N\<and>r=n_NI_Remote_PutX dst)" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a1 obtain dst where a1:"dst\<le>N\<and>r=n_NI_Remote_PutX dst" apply fastforce done
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "(dst=p__Inv4)\<or>(dst~=p__Inv4)" apply (cut_tac a1 a2, auto) done
moreover {
assume b1: "(dst=p__Inv4)"
have "?P1 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
moreover {
assume b1: "(dst~=p__Inv4)"
have "?P2 s"
proof(cut_tac a1 a2 b1, auto) qed
then have "invHoldForRule s f r (invariants N)" by auto
}
ultimately show "invHoldForRule s f r (invariants N)" by satx
qed
lemma n_PI_Local_Get_GetVsinv__90:
assumes a1: "(r=n_PI_Local_Get_Get )" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "?P3 s"
apply (cut_tac a1 a2 , simp, rule_tac x="(neg (andForm (andForm (eqn (IVar (Field (Para (Field (Ident ''Sta'') ''UniMsg'') p__Inv4) ''Cmd'')) (Const UNI_GetX)) (eqn (IVar (Field (Para (Field (Ident ''Sta'') ''UniMsg'') p__Inv4) ''HomeProc'')) (Const false))) (eqn (IVar (Field (Field (Ident ''Sta'') ''Dir'') ''Pending'')) (Const false))))" in exI, auto) done
then show "invHoldForRule s f r (invariants N)" by auto
qed
lemma n_PI_Local_GetX_GetX__part__0Vsinv__90:
assumes a1: "(r=n_PI_Local_GetX_GetX__part__0 )" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "?P1 s"
proof(cut_tac a1 a2 , auto) qed
then show "invHoldForRule s f r (invariants N)" by auto
qed
lemma n_PI_Local_GetX_GetX__part__1Vsinv__90:
assumes a1: "(r=n_PI_Local_GetX_GetX__part__1 )" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "?P1 s"
proof(cut_tac a1 a2 , auto) qed
then show "invHoldForRule s f r (invariants N)" by auto
qed
lemma n_NI_Nak_HomeVsinv__90:
assumes a1: "(r=n_NI_Nak_Home )" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "?P1 s"
proof(cut_tac a1 a2 , auto) qed
then show "invHoldForRule s f r (invariants N)" by auto
qed
lemma n_NI_Local_PutVsinv__90:
assumes a1: "(r=n_NI_Local_Put )" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "?P1 s"
proof(cut_tac a1 a2 , auto) qed
then show "invHoldForRule s f r (invariants N)" by auto
qed
lemma n_NI_Local_PutXAcksDoneVsinv__90:
assumes a1: "(r=n_NI_Local_PutXAcksDone )" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)" (is "?P1 s \<or> ?P2 s \<or> ?P3 s")
proof -
from a2 obtain p__Inv4 where a2:"p__Inv4\<le>N\<and>f=inv__90 p__Inv4" apply fastforce done
have "?P1 s"
proof(cut_tac a1 a2 , auto) qed
then show "invHoldForRule s f r (invariants N)" by auto
qed
lemma n_PI_Local_GetX_PutX__part__0Vsinv__90:
assumes a1: "r=n_PI_Local_GetX_PutX__part__0 " and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_NI_WbVsinv__90:
assumes a1: "r=n_NI_Wb " and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_StoreVsinv__90:
assumes a1: "\<exists> src data. src\<le>N\<and>data\<le>N\<and>r=n_Store src data" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_NI_InvAck_3Vsinv__90:
assumes a1: "\<exists> src. src\<le>N\<and>r=n_NI_InvAck_3 N src" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_NI_InvAck_1Vsinv__90:
assumes a1: "\<exists> src. src\<le>N\<and>r=n_NI_InvAck_1 N src" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_PI_Remote_ReplaceVsinv__90:
assumes a1: "\<exists> src. src\<le>N\<and>r=n_PI_Remote_Replace src" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_Store_HomeVsinv__90:
assumes a1: "\<exists> data. data\<le>N\<and>r=n_Store_Home data" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_PI_Local_ReplaceVsinv__90:
assumes a1: "r=n_PI_Local_Replace " and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_NI_InvAck_existsVsinv__90:
assumes a1: "\<exists> src pp. src\<le>N\<and>pp\<le>N\<and>src~=pp\<and>r=n_NI_InvAck_exists src pp" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_PI_Remote_PutXVsinv__90:
assumes a1: "\<exists> dst. dst\<le>N\<and>r=n_PI_Remote_PutX dst" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_NI_InvVsinv__90:
assumes a1: "\<exists> dst. dst\<le>N\<and>r=n_NI_Inv dst" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_PI_Local_PutXVsinv__90:
assumes a1: "r=n_PI_Local_PutX " and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_PI_Local_Get_PutVsinv__90:
assumes a1: "r=n_PI_Local_Get_Put " and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_NI_ShWbVsinv__90:
assumes a1: "r=n_NI_ShWb N " and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_PI_Local_GetX_PutX_HeadVld__part__0Vsinv__90:
assumes a1: "r=n_PI_Local_GetX_PutX_HeadVld__part__0 N " and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_NI_ReplaceVsinv__90:
assumes a1: "\<exists> src. src\<le>N\<and>r=n_NI_Replace src" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_PI_Local_GetX_PutX__part__1Vsinv__90:
assumes a1: "r=n_PI_Local_GetX_PutX__part__1 " and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_NI_InvAck_exists_HomeVsinv__90:
assumes a1: "\<exists> src. src\<le>N\<and>r=n_NI_InvAck_exists_Home src" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_NI_Replace_HomeVsinv__90:
assumes a1: "r=n_NI_Replace_Home " and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_NI_Nak_ClearVsinv__90:
assumes a1: "r=n_NI_Nak_Clear " and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_NI_InvAck_2Vsinv__90:
assumes a1: "\<exists> src. src\<le>N\<and>r=n_NI_InvAck_2 N src" and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_PI_Local_GetX_PutX_HeadVld__part__1Vsinv__90:
assumes a1: "r=n_PI_Local_GetX_PutX_HeadVld__part__1 N " and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
lemma n_NI_FAckVsinv__90:
assumes a1: "r=n_NI_FAck " and
a2: "(\<exists> p__Inv4. p__Inv4\<le>N\<and>f=inv__90 p__Inv4)"
shows "invHoldForRule s f r (invariants N)"
apply (rule noEffectOnRule, cut_tac a1 a2, auto) done
end
|
module Blend2D
using Libdl
depsfile = joinpath(dirname(@__DIR__), "deps", "deps.jl")
if isfile(depsfile)
include(depsfile)
else
error("Package \"Blend2D\" is not properly installed (missing deps/deps.jl). Please run Pkg.build(\"Blend2D\") first.")
end
include("gen/enums.jl")
include("gen/structs.jl")
mutable struct BLMatrix2D
m00::Cdouble
m01::Cdouble
m10::Cdouble
m11::Cdouble
m20::Cdouble
m21::Cdouble
BLMatrix2D() = new(0, 0, 0, 0, 0, 0)
end
include("gen/funcs.jl")
function blImageCodecBuiltInCodecs()
ptr = ccall((:blImageCodecBuiltInCodecs, libblend2d), Ptr{BLArrayCore}, ())
ret = BLArrayCore()
blArrayInit(ret, Cuint(0))
ccall((:blArrayAssignWeak, libblend2d), Cuint, (Ref{BLArrayCore}, Ptr{BLArrayCore}), ret, ptr)
return ret
end
include("gen/export.jl")
function __init__()
if Libdl.dlopen(libblend2d, throw_error=false) in (C_NULL, nothing)
error("$(libblend2d) cannot be opened, Please re-run Pkg.build(\"Blend2D\"), and restart Julia.")
end
end
end # module Blend2D |
[STATEMENT]
lemma components_isotone:
"x \<le> y \<Longrightarrow> components x \<le> components y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. x \<le> y \<Longrightarrow> components x \<le> components y
[PROOF STEP]
by (simp add: pp_isotone star_isotone) |
-- Idris implementation of a type-correct, stack-safe
-- compiler including exception handling.
--
-- Morten S. Knudsen, Jeppe Vinberg, Francisco M. Lasaca
import Data.List
%default total
data TyExp = NatTy | BoolTy
VariableId : Type
VariableId = String
mutual
StackType : Type
StackType = List Ty
HeapType : Type
HeapType = List (VariableId, TyExp)
data Ty = Han StackType StackType HeapType HeapType | Val TyExp
data V : TyExp -> Type where
VNat : Nat -> V NatTy
VBool : Bool -> V BoolTy
data Exp : Bool -> TyExp -> List (VariableId, TyExp) -> Type where
VarExp : (vId : VariableId) -> {auto p : Elem (vId, ty) env} -> Exp False ty env
SingleExp : (v : V t) -> Exp False t env
PlusExp : (x : Exp a NatTy env) -> (y : Exp b NatTy env) -> Exp (a || b) NatTy env
IfExp : (cond : Exp a BoolTy env) -> (x : Exp b t env) -> (y : Exp c t env) -> Exp (a || b || c) t env
ThrowExp : Exp True t env
CatchExp : (x : Exp a t env) -> (h : Exp b t env) -> Exp (a && b) t env
data Program : List (VariableId, TyExp) -> List (VariableId, TyExp) -> Type where
EmptyProgram : Program env env
Declaration : (vId : VariableId) ->
(exp : Exp b t env) ->
{auto expExecutable : b = False} ->
(continuing : Program ((vId, t) :: env) env') ->
(Program env env')
Assignment : (vId : VariableId) ->
(exp : Exp b t env) ->
{auto expExecutable : b = False} ->
(continuing : Program ((vId, t) :: env) env') ->
{auto prf' : Elem (vId, t) env} ->
(Program env env')
data ValuesEnv : List (VariableId, TyExp) -> Type where
EmptyValuesEnv : ValuesEnv []
MoreValuesEnv : (vId: VariableId) -> V ty -> ValuesEnv envTy
-> ValuesEnv ((vId, ty) :: envTy)
mutual
evalVarExp : (x : ValuesEnv tEnv) -> (p : Elem (vId, ty) tEnv) -> V ty
evalVarExp (MoreValuesEnv _ val _) Here = val
evalVarExp (MoreValuesEnv _ _ valueEnv) (There later) = evalVarExp valueEnv later
evalPlusExp : (x : Exp a NatTy tEnv) -> (y : Exp b NatTy tEnv) -> (valuesEnv : ValuesEnv tEnv) -> (prf : (a || (Delay b)) = False) -> V NatTy
evalPlusExp x y valuesEnv prf {a = False} {b = False} =
case eval x valuesEnv of
(VNat x') => case eval y valuesEnv of
(VNat y') => VNat (x' + y')
evalPlusExp _ _ _ Refl {a = False} {b = True} impossible
evalPlusExp _ _ _ Refl {a = True} {b = _} impossible
evalIfExp : (cond : Exp a BoolTy tEnv) -> (x : Exp b t tEnv) -> (y : Exp c t tEnv) -> (valuesEnv : ValuesEnv tEnv) -> (prf : (a || (Delay (b || (Delay c)))) = False) -> V t
evalIfExp cond x y valuesEnv prf {a = False} {b = False} {c = False} =
case eval cond valuesEnv of
VBool True => eval x valuesEnv
VBool False => eval y valuesEnv
evalIfExp _ _ _ _ Refl {a = False} {b = False} {c = True} impossible
evalIfExp _ _ _ _ Refl {a = False} {b = False} {c = True} impossible
evalIfExp _ _ _ _ Refl {a = True} {b = _} {c = _} impossible
evalCatchExp : (x : Exp a t tEnv) -> (h : Exp b t tEnv) -> (valuesEnv : ValuesEnv tEnv) ->(prf : (a && (Delay b)) = False) -> V t
evalCatchExp x h valuesEnv prf {a = False} = eval x valuesEnv
evalCatchExp x h valuesEnv prf {a = True} {b = False} = eval h valuesEnv
evalCatchExp _ _ _ Refl {a = True} {b = True} impossible
eval : (e : Exp b t tEnv) -> (valuesEnv : ValuesEnv tEnv) -> {auto prf : b = False} -> V t
eval (VarExp vId {p}) valuesEnv = evalVarExp valuesEnv p
eval (SingleExp v) valuesEnv = v
eval (PlusExp x y) valuesEnv {prf} = evalPlusExp x y valuesEnv prf
eval (IfExp cond x y) valuesEnv {prf} = evalIfExp cond x y valuesEnv prf
eval ThrowExp _ {prf = Refl} impossible
eval (CatchExp x h) valuesEnv {prf}= evalCatchExp x h valuesEnv prf
evPro : (p : Program env env') -> (valueEnv : ValuesEnv env) -> ValuesEnv env'
evPro EmptyProgram valueEnv = valueEnv
evPro (Declaration vId exp continuing) valueEnv =
let evaluated = eval exp valueEnv in
evPro continuing (MoreValuesEnv vId evaluated valueEnv)
evPro (Assignment vId exp continuing) valueEnv =
let evaluated = eval exp valueEnv in
evPro continuing (MoreValuesEnv vId evaluated valueEnv)
evalProgram : (p : Program [] env') -> ValuesEnv env'
evalProgram p = evPro p EmptyValuesEnv
mutual
El : Ty -> Type
El (Han t t' h h') = Code t t' h h'
El (Val NatTy) = Nat
El (Val BoolTy) = Bool
data Code : (s : StackType) -> (s' : StackType) -> (h: HeapType) -> (h': HeapType) -> Type where
STORE : (vId: VariableId) -> (c: Code s s' ((vId, ty)::h) h') -> Code ((Val ty)::s) s' h h'
LOAD : (vId: VariableId) -> {auto prf: Elem (vId, ty) h} -> (c: Code ((Val ty)::s) s' h h') -> Code s s' h h'
PUSH : V tyExp -> Code (Val tyExp :: s) s' h h' -> Code s s' h h'
ADD : Code (Val NatTy :: s) s' h h' -> Code (Val NatTy :: Val NatTy :: s) s' h h'
IF : (c1 : Code s s' h h') -> (c2 : Code s s' h h') -> Code (Val BoolTy :: s) s' h h'
THROW : Code (s'' ++ (Han s s' h h') :: s) s' h h'
MARK : (han : Code s s' h h') -> (c : Code ((Han s s' h h') :: s) s' h h') -> Code s s' h h'
UNMARK : Code (t :: s) s' h h' -> Code (t :: (Han s s' h h') :: s) s' h h'
HALT : Code s s h h
mutual
compCatch : Exp b ty tenv -> Code (Val ty :: (s'' ++ (Han s s' tenv h') :: s)) s' tenv h' -> Code (s'' ++ (Han s s' tenv h') :: s) s' tenv h'
compCatch (VarExp vId) c = LOAD vId c
compCatch (SingleExp v) c = PUSH v c
compCatch (PlusExp x y) c = compCatch x (compCatch {s'' = Val NatTy :: _} y (ADD c))
compCatch {s} {s''} (IfExp cond x y) c = compCatch cond (IF (compCatch x c) (compCatch y c))
compCatch ThrowExp c = THROW
compCatch (CatchExp x h) c = MARK (compCatch h c) (compCatch {s'' = []} x (UNMARK c))
compPlusExp : (p : (a || b) = False) -> (x : Exp a NatTy tenv) -> (y : Exp b NatTy tenv) -> (c : Code ((Val NatTy) :: s) s' tenv h') -> Code s s' tenv h'
compPlusExp {a = False} {b = False} Refl x y c = comp Refl x (comp Refl y (ADD c))
compPlusExp {a = False} {b = True} Refl _ _ _ impossible
compPlusExp {a = True} {b = _} Refl _ _ _ impossible
compCatchExp : (p : (a && b) = False) -> (x : Exp a ty tenv) -> (handler : Exp b ty tenv) -> (c : Code ((Val ty) :: s) s' tenv h') -> Code s s' tenv h'
compCatchExp {a = False} Refl x handler c = comp Refl x c
compCatchExp {a = True} {b = False} p x handler c = MARK (comp Refl handler c) (compCatch {s'' = []} x (UNMARK c))
compCatchExp {a = True} {b = True} Refl _ _ _ impossible
compIfExp : (p : (a || b || c) = False) -> (cond : Exp a BoolTy tenv) ->(x : Exp b ty tenv) -> (y : Exp c ty tenv) -> (co : Code ((Val ty) :: s) s' tenv h') -> Code s s' tenv h'
compIfExp {a = False} {b = False} {c = False} Refl cond x y co = comp Refl cond (IF (comp Refl x co) (comp Refl y co))
compIfExp {a = False} {b = False} {c = True} Refl _ _ _ _ impossible
compIfExp {a = False} {b = False} {c = True} Refl _ _ _ _ impossible
compIfExp {a = True} Refl _ _ _ _ impossible
comp : (b = False) -> Exp b ty tenv -> Code (Val ty :: s) s' tenv h' -> Code s s' tenv h'
comp _ (VarExp {p} vId) {tenv} c = LOAD vId c
comp p (SingleExp v) c = PUSH v c
comp p (PlusExp x y) c = compPlusExp p x y c
comp p (IfExp cond x y) co = compIfExp p cond x y co
comp p (CatchExp x h) c = compCatchExp p x h c
comp Refl ThrowExp _ impossible
partial
compile : (prog: Program tenv tenv') -> Code [] [] tenv tenv'
compile (Declaration vId exp {expExecutable} continuing) =
comp expExecutable exp (STORE vId (compile continuing))
compile (Assignment vId exp {expExecutable} continuing) =
comp expExecutable exp (STORE vId (compile continuing))
compile EmptyProgram = HALT
data Stack : (s : StackType) -> Type where
Nil : Stack []
(::) : El t -> Stack s -> Stack (t :: s)
data Heap : (h : HeapType) -> Type where
HeapNil : Heap []
HeapCons : (vId: VariableId) -> V t -> Heap h -> Heap ((vId, t) :: h)
mutual
lookup: Heap h -> (p: Elem (vId, ty) h) -> V ty
lookup (HeapCons vId val tl) Here = val
lookup (HeapCons _ _ tl) (There later) = lookup tl later
partial
exec : Code s s' h h' -> Stack s -> Heap h -> (Stack s', Heap h')
exec (LOAD {prf} vId c) s h = case lookup h prf of
(VNat v) => exec c (v :: s) h
(VBool v) => exec c (v :: s) h
exec (STORE vId c) {s=(Val NatTy)::_} (x :: tl) h = exec c tl (HeapCons vId (VNat x) h)
exec (STORE vId c) {s=(Val BoolTy)::_} (x :: tl) h = exec c tl (HeapCons vId (VBool x) h)
exec (PUSH (VNat x) c) s h = exec c (x :: s) h
exec (PUSH (VBool x) c) s h = exec c (x :: s) h
exec (ADD c) (m :: n :: s) h = exec c ((n + m) :: s) h
exec (IF c1 c2) (True :: s) h = exec c1 s h
exec (IF c1 c2) (False :: s) h = exec c2 s h
exec THROW s h = fail s h
exec (MARK handler c) s h = exec c (handler :: s) h
exec (UNMARK c) (x :: handler :: s) h = exec c (x :: s) h
exec HALT s h = (s, h)
partial
fail : Stack (s'' ++ Han s s' h h' :: s) -> Heap h -> (Stack s', Heap h')
fail {s'' = []} (handler' :: s) h = exec handler' s h
fail {s'' = (_ :: _)} (_ :: s) h = fail s h
-- Example of an entire program
-- `entireProgram`
-- x <- 3 -- []
-- x <- x + 1 -- [x <- 3]
-- y <- x + 2 -- [x <- 4]
-- emptyProgram -- [y <- 6, x <- 4]
myEmpty : Program [("y", NatTy), ("x", NatTy), ("x", NatTy)] [("y", NatTy), ("x", NatTy), ("x", NatTy)]
myEmpty = EmptyProgram
yEqualsXPlusTwo : Program [("x", NatTy), ("x", NatTy)] [("y", NatTy), ("x", NatTy), ("x", NatTy)]
yEqualsXPlusTwo = Declaration "y" (PlusExp (VarExp "x") (SingleExp (VNat 2))) myEmpty
xEqualsXPlusOne : Program [("x", NatTy)] [("y", NatTy), ("x", NatTy), ("x", NatTy)]
xEqualsXPlusOne = Assignment "x" (PlusExp (VarExp "x") (SingleExp (VNat 1))) yEqualsXPlusTwo
entireProgram : Program [] [("y", NatTy), ("x", NatTy), ("x", NatTy)]
entireProgram = Declaration "x" (SingleExp (VNat 3)) xEqualsXPlusOne
evaluatedProgram : ValuesEnv [("y", NatTy), ("x", NatTy), ("x", NatTy)]
evaluatedProgram = evalProgram entireProgram
compiledProgram : Code [] [] [] [("y", NatTy), ("x", NatTy), ("x", NatTy)]
compiledProgram = compile entireProgram
partial
executedProgram : (Stack [], Heap [("y", NatTy), ("x", NatTy), ("x", NatTy)])
executedProgram = exec (compiledProgram) [] HeapNil
|
(*<*)
theory Trace
imports Basis
begin
declare Let_def[simp] if_split_asm[split]
(*>*)
section\<open>A trace based model\<close>
text\<open>The only clumsy aspect of the state based model is \<open>safe\<close>: we use a state component to record if the sequence of events
that lead to a state satisfies some property. That is, we simulate a
condition on traces via the state. Unsurprisingly, it is not trivial
to convince oneself that \<open>safe\<close> really has the informal meaning
set out at the beginning of subsection~\ref{sec:formalizing-safety}.
Hence we now describe an alternative, purely trace based model,
similar to Paulson's inductive protocol model~\<^cite>\<open>"Paulson-JCS98"\<close>.
The events are:
\<close>
datatype event =
Check_in guest room card | Enter guest room card | Exit guest room
text\<open>Instead of a state, we have a trace, i.e.\ list of events, and
extract the state from the trace:\<close>
consts
initk :: "room \<Rightarrow> key"
primrec owns :: "event list \<Rightarrow> room \<Rightarrow> guest option" where
"owns [] r = None" |
"owns (e#s) r = (case e of
Check_in g r' c \<Rightarrow> if r' = r then Some g else owns s r |
Enter g r' c \<Rightarrow> owns s r |
Exit g r' \<Rightarrow> owns s r)"
primrec currk :: "event list \<Rightarrow> room \<Rightarrow> key" where
"currk [] r = initk r" |
"currk (e#s) r = (let k = currk s r in
case e of Check_in g r' c \<Rightarrow> if r' = r then snd c else k
| Enter g r' c \<Rightarrow> k
| Exit g r \<Rightarrow> k)"
primrec issued :: "event list \<Rightarrow> key set" where
"issued [] = range initk" |
"issued (e#s) = issued s \<union>
(case e of Check_in g r c \<Rightarrow> {snd c} | Enter g r c \<Rightarrow> {} | Exit g r \<Rightarrow> {})"
primrec cards :: "event list \<Rightarrow> guest \<Rightarrow> card set" where
"cards [] g = {}" |
"cards (e#s) g = (let C = cards s g in
case e of Check_in g' r c \<Rightarrow> if g' = g then insert c C
else C
| Enter g r c \<Rightarrow> C
| Exit g r \<Rightarrow> C)"
primrec roomk :: "event list \<Rightarrow> room \<Rightarrow> key" where
"roomk [] r = initk r" |
"roomk (e#s) r = (let k = roomk s r in
case e of Check_in g r' c \<Rightarrow> k
| Enter g r' (x,y) \<Rightarrow> if r' = r \<^cancel>\<open>\<and> x = k\<close> then y else k
| Exit g r \<Rightarrow> k)"
primrec isin :: "event list \<Rightarrow> room \<Rightarrow> guest set" where
"isin [] r = {}" |
"isin (e#s) r = (let G = isin s r in
case e of Check_in g r c \<Rightarrow> G
| Enter g r' c \<Rightarrow> if r' = r then {g} \<union> G else G
| Exit g r' \<Rightarrow> if r'=r then G - {g} else G)"
primrec hotel :: "event list \<Rightarrow> bool" where
"hotel [] = True" |
"hotel (e # s) = (hotel s & (case e of
Check_in g r (k,k') \<Rightarrow> k = currk s r \<and> k' \<notin> issued s |
Enter g r (k,k') \<Rightarrow> (k,k') : cards s g & (roomk s r : {k, k'}) |
Exit g r \<Rightarrow> g : isin s r))"
text\<open>Except for @{const initk}, which is completely unspecified,
all these functions are defined by primitive recursion over traces:
@{thm[display]owns.simps}
@{thm[display]currk.simps}
@{thm[display]issued.simps}
@{thm[display]cards.simps}
@{thm[display]roomk.simps}
@{thm[display]isin.simps}
However, not every trace is possible. Function @{const hotel} tells us
which traces correspond to real hotels:
@{thm[display]hotel.simps}
Alternatively we could have followed Paulson~\<^cite>\<open>"Paulson-JCS98"\<close>
in defining @{const hotel} as an inductive set of traces.
The difference is only slight.
\subsection{Formalizing safety}
\label{sec:FormalSafetyTrace}
The principal advantage of the trace model is the intuitive
specification of safety. Using the auxiliary predicate \<open>no_Check_in\<close>
\<close>
(*<*)abbreviation no_Check_in :: "event list \<Rightarrow> room \<Rightarrow> bool" where(*>*)
"no_Check_in s r \<equiv> \<not>(\<exists>g c. Check_in g r c \<in> set s)"
text\<open>\medskip\noindent we define a trace to be \<open>safe\<^sub>0\<close> for a
room if the card obtained at the last @{const Check_in} was later
actually used to @{const Enter} the room:\<close>
(*<*)definition safe\<^sub>0 :: "event list \<Rightarrow> room \<Rightarrow> bool" where(*>*)
"safe\<^sub>0 s r = (\<exists>s\<^sub>1 s\<^sub>2 s\<^sub>3 g c.
s = s\<^sub>3 @ [Enter g r c] @ s\<^sub>2 @ [Check_in g r c] @ s\<^sub>1 \<and> no_Check_in (s\<^sub>3 @ s\<^sub>2) r)"
text\<open>\medskip\noindent A trace is \<open>safe\<close> if additionally the room was
empty when it was entered:\<close>
(*<*)definition safe :: "event list \<Rightarrow> room \<Rightarrow> bool" where(*>*)
"safe s r = (\<exists>s\<^sub>1 s\<^sub>2 s\<^sub>3 g c.
s = s\<^sub>3 @ [Enter g r c] @ s\<^sub>2 @ [Check_in g r c] @ s\<^sub>1 \<and>
no_Check_in (s\<^sub>3 @ s\<^sub>2) r \<and> isin (s\<^sub>2 @ [Check_in g r c] @ s\<^sub>1) r = {})"
text\<open>\medskip\noindent The two notions of safety are distinguished because,
except for the main theorem, @{const safe\<^sub>0} suffices.
The alert reader may already have wondered why, in contrast to the
state based model, we do not require @{const initk} to be
injective. If @{const initk} is not injective, e.g.\ @{prop"initk
r\<^sub>1 = initk r\<^sub>2"} and @{prop"r\<^sub>1 \<noteq> r\<^sub>2"},
then @{term"[Enter g r\<^sub>2 (initk r\<^sub>1,k), Check_in g
r\<^sub>1 (initk r\<^sub>1,k)]"} is a legal trace and guest \<open>g\<close> ends up in a room he is not the owner of. However, this is not a
safe trace for room \<open>r\<^sub>2\<close> according to our
definition. This reflects that hotel rooms are not safe until
the first time their owner has entered them. We no longer protect the
hotel from its guests.\<close>
(* state thm w/o "isin"
hotel s ==> s = Enter g # s' \<Longrightarrow> owns s' r = Some g \<or> s' = s1 @ Checkin g @ s2 \<and>
no checkin, no enter in s1
*)
(*<*)
lemma safe_safe: "safe s r \<Longrightarrow> safe\<^sub>0 s r"
by (simp add: safe\<^sub>0_def safe_def) blast
lemma initk_issued[simp]: "hotel s \<Longrightarrow> initk r \<in> issued s"
by (induct s) (auto split:event.split)
lemma currk_issued[simp]: "hotel s \<Longrightarrow> currk s r \<in> issued s"
by (induct s) (auto split:event.split)
lemma key1_issued[simp]: "hotel s \<Longrightarrow> (k,k') : cards s g \<Longrightarrow> k \<in> issued s"
by (induct s) (auto split:event.split)
lemma key2_issued[simp]: "hotel s \<Longrightarrow> (k,k') : cards s g \<Longrightarrow> k' \<in> issued s"
by (induct s) (auto split:event.split)
lemma roomk_issued[simp]: "hotel s \<Longrightarrow> roomk s r \<in> issued s"
by (induct s) (auto split:event.split)
lemma issued_app: "issued (s @ s') = issued s \<union> issued s'"
apply (induct s) apply (auto split:event.split)
apply (induct s') apply (auto split:event.split)
done
lemma owns_app[simp]: "no_Check_in s\<^sub>2 r \<Longrightarrow> owns (s\<^sub>2 @ s\<^sub>1) r = owns s\<^sub>1 r"
by (induct s\<^sub>2) (auto split:event.split)
lemma currk_app[simp]: "no_Check_in s\<^sub>2 r \<Longrightarrow> currk (s\<^sub>2 @ s\<^sub>1) r = currk s\<^sub>1 r"
by (induct s\<^sub>2) (auto split:event.split)
lemma currk_Check_in:
"\<lbrakk> hotel (s\<^sub>2 @ Check_in g r (k, k')# s\<^sub>1);
k' = currk (s\<^sub>2 @ Check_in g r (k, k') # s\<^sub>1) r' \<rbrakk> \<Longrightarrow> r' = r"
by (induct s\<^sub>2) (auto simp: issued_app split:event.splits)
lemma no_checkin_no_newkey:
"\<lbrakk> hotel(s\<^sub>2 @ [Check_in g r (k,k')] @ s\<^sub>1); no_Check_in s\<^sub>2 r \<rbrakk>
\<Longrightarrow> (k',k'') \<notin> cards (s\<^sub>2 @ Check_in g r (k,k') # s\<^sub>1) g'"
apply(induct s\<^sub>2)
apply fastforce
apply(fastforce split:event.splits dest: currk_Check_in)
done
lemma guest_key2_disj2[simp]:
"\<lbrakk> hotel s; (k\<^sub>1,k) \<in> cards s g\<^sub>1; (k\<^sub>2,k) \<in> cards s g\<^sub>2 \<rbrakk> \<Longrightarrow> g\<^sub>1=g\<^sub>2"
apply (induct s)
apply(auto split:event.splits)
done
lemma safe_roomk_currk[simp]:
"hotel s \<Longrightarrow> safe\<^sub>0 s r \<Longrightarrow> roomk s r = currk s r"
apply(clarsimp simp:safe\<^sub>0_def)
apply(hypsubst_thin)
apply(erule rev_mp)+
apply(induct_tac s\<^sub>3)
apply(auto split:event.split)
apply(rename_tac guest ba)
apply(subgoal_tac "(b, ba)
\<notin> cards ((list @ Enter g r (a, b) # s\<^sub>2) @ Check_in g r (a, b) # s\<^sub>1)
guest")
apply simp
apply(rule no_checkin_no_newkey) apply simp_all
done
(* A short proof *)
lemma "\<lbrakk> hotel s; safe s r; g \<in> isin s r \<rbrakk> \<Longrightarrow> owns s r = Some g"
apply(clarsimp simp add:safe_def)
apply(hypsubst_thin)
apply(rename_tac g' k k')
apply(erule rev_mp)+
apply(induct_tac s\<^sub>3)
apply simp
apply (auto split:event.split)
apply(subgoal_tac
"safe\<^sub>0 (list @ Enter g' r (k,k') # s\<^sub>2 @ Check_in g' r (k, k') # s\<^sub>1) r")
prefer 2
apply(simp add:safe\<^sub>0_def)apply blast
apply(simp)
apply(cut_tac s\<^sub>2 = "list @ Enter g' r (k, k') # s\<^sub>2" in no_checkin_no_newkey)
apply simp
apply simp
apply simp
apply fast
apply(subgoal_tac
"safe\<^sub>0 (list @ Enter g' r (k,k') # s\<^sub>2 @ Check_in g' r (k, k') # s\<^sub>1) r")
apply(drule (1) only_owner_enter_normal)
apply blast
apply simp
apply(simp add:safe\<^sub>0_def)
apply blast
done
lemma in_set_conv_decomp_firstD:
assumes "P x"
shows "x \<in> set xs \<Longrightarrow>
\<exists>ys x zs. xs = ys @ x # zs \<and> P x \<and> (\<forall>y \<in> set ys. \<not> P y)"
(is "_ \<Longrightarrow> \<exists>ys x zs. ?P xs ys x zs")
proof (induct xs)
case Nil thus ?case by simp
next
case (Cons a xs)
show ?case
proof cases
assume "x = a \<or> P a" hence "?P (a#xs) [] a xs" using \<open>P x\<close> by auto
thus ?case by blast
next
assume "\<not>(x = a \<or> P a)"
with assms Cons show ?case by clarsimp (fastforce intro!: Cons_eq_appendI)
qed
qed
lemma ownsD: "owns s r = Some g \<Longrightarrow>
\<exists>s\<^sub>1 s\<^sub>2 g c. s = s\<^sub>2 @ [Check_in g r c] @ s\<^sub>1 \<and> no_Check_in s\<^sub>2 r"
apply(induct s)
apply simp
apply (auto split:event.splits)
apply(rule_tac x = s in exI)
apply(rule_tac x = "[]" in exI)
apply simp
apply(rule_tac x = s\<^sub>1 in exI)
apply simp
apply(rule_tac x = s\<^sub>1 in exI)
apply simp
apply(rule_tac x = s\<^sub>1 in exI)
apply simp
done
lemma no_Check_in_owns[simp]: "no_Check_in s r \<Longrightarrow> owns s r = None"
by (induct s) (auto split:event.split)
theorem Enter_safe:
"\<lbrakk> hotel(Enter g r c # s); safe\<^sub>0 s r \<rbrakk> \<Longrightarrow> owns s r = Some g"
apply(subgoal_tac "\<exists>s\<^sub>1 s\<^sub>2 g c. s = s\<^sub>2 @ [Check_in g r c] @ s\<^sub>1 \<and> no_Check_in s\<^sub>2 r")
prefer 2
apply(simp add:safe\<^sub>0_def)
apply(elim exE conjE)
apply(rule_tac x = s\<^sub>1 in exI)
apply (simp)
apply(elim exE conjE)
apply(cases c)
apply(clarsimp)
apply(erule disjE)
apply (simp add:no_checkin_no_newkey)
apply simp
apply(frule only_owner_enter_normal)
apply assumption
apply simp
apply simp
done
lemma safe_future: "safe\<^sub>0 s r \<Longrightarrow> no_Check_in s' r \<Longrightarrow> safe\<^sub>0 (s' @ s) r"
apply(clarsimp simp:safe\<^sub>0_def)
apply(rule_tac x = s\<^sub>1 in exI)
apply(rule_tac x = s\<^sub>2 in exI)
apply simp
done
corollary Enter_safe_future:
"\<lbrakk> hotel(Enter g r c # s' @ s); safe\<^sub>0 s r; no_Check_in s' r \<rbrakk>
\<Longrightarrow> owns s r = Some g"
apply(drule (1) safe_future)
apply(drule (1) Enter_safe)
apply simp
done
(*>*)
text_raw\<open>
\begin{figure}
\begin{center}\begin{minipage}{\textwidth}
\isastyle\isamarkuptrue
\<close>
theorem safe: assumes "hotel s" and "safe s r" and "g \<in> isin s r"
shows "owns s r = \<lfloor>g\<rfloor>"
proof -
{ fix s\<^sub>1 s\<^sub>2 s\<^sub>3 g' k k'
let ?b = "[Enter g' r (k,k')] @ s\<^sub>2 @ [Check_in g' r (k,k')] @ s\<^sub>1"
let ?s = "s\<^sub>3 @ ?b"
assume 0: "isin (s\<^sub>2 @ [Check_in g' r (k,k')] @ s\<^sub>1) r = {}"
have "\<lbrakk> hotel ?s; no_Check_in (s\<^sub>3 @ s\<^sub>2) r; g \<in> isin ?s r \<rbrakk> \<Longrightarrow> g' = g"
proof(induct s\<^sub>3)
case Nil thus ?case using 0 by simp
next
case (Cons e s\<^sub>3)
let ?s = "s\<^sub>3 @ ?b" and ?t = "(e \<cdot> s\<^sub>3) @ ?b"
show ?case
proof(cases e)
case [simp]: (Enter g'' r' c)
show "g' = g"
proof cases
assume [simp]: "r' = r"
show "g' = g"
proof cases
assume [simp]: "g'' = g"
have 1: "hotel ?s" and 2: "c \<in> cards ?s g" using \<open>hotel ?t\<close> by auto
have 3: "safe ?s r" using \<open>no_Check_in ((e \<cdot> s\<^sub>3) @ s\<^sub>2) r\<close> 0
by(simp add:safe_def) blast
obtain k\<^sub>1 k\<^sub>2 where [simp]: "c = (k\<^sub>1,k\<^sub>2)" by force
have "roomk ?s r = k'"
using safe_roomk_currk[OF 1 safe_safe[OF 3]]
\<open>no_Check_in ((e \<cdot> s\<^sub>3) @ s\<^sub>2) r\<close> by auto
hence "k\<^sub>1 \<noteq> roomk ?s r"
using no_checkin_no_newkey[where s\<^sub>2 = "s\<^sub>3 @ [Enter g' r (k,k')] @ s\<^sub>2"]
1 2 \<open>no_Check_in ((e \<cdot> s\<^sub>3) @ s\<^sub>2) r\<close> by auto
hence "k\<^sub>2 = roomk ?s r" using \<open>hotel ?t\<close> by auto
with only_owner_enter_normal[OF 1 safe_safe[OF 3]] 2
have "owns ?t r = \<lfloor>g\<rfloor>" by auto
moreover have "owns ?t r = \<lfloor>g'\<rfloor>"
using \<open>hotel ?t\<close> \<open>no_Check_in ((e \<cdot> s\<^sub>3) @ s\<^sub>2) r\<close> by simp
ultimately show "g' = g" by simp
next
assume "g'' \<noteq> g" thus "g' = g" using Cons by auto
qed
next
assume "r' \<noteq> r" thus "g' = g" using Cons by auto
qed
qed (insert Cons, auto)
qed
} with assms show "owns s r = \<lfloor>g\<rfloor>" by(auto simp:safe_def)
qed
text_raw\<open>
\end{minipage}
\end{center}
\caption{Isar proof of Theorem~\ref{safe}}\label{fig:proof}
\end{figure}
\<close>
text\<open>
\subsection{Verifying safety}
Lemma~\ref{state-lemmas} largely carries over after replacing
\mbox{@{prop"s : reach"}} by @{prop"hotel s"} and @{const safe} by
@{const safe\<^sub>0}. Only properties \ref{currk_inj} and
\ref{key1_not_currk} no longer hold because we no longer assume that
@{const roomk} is initially injective.
They are replaced by two somewhat similar properties:
\begin{lemma}\label{trace-lemmas}\mbox{}
\begin{enumerate}
\item @{thm[display,margin=80]currk_Check_in}
\item \label{no_checkin_no_newkey}
@{thm[display,margin=100] no_checkin_no_newkey}
\end{enumerate}
\end{lemma}
Both are proved by induction on \<open>s\<^sub>2\<close>.
In addition we need some easy structural properties:
\begin{lemma}\label{app-lemmas}
\begin{enumerate}
\item @{thm issued_app}
\item @{thm owns_app}
\item \label{currk_app} @{thm currk_app}
\end{enumerate}
\end{lemma}
The main theorem again correspond closely to its state based
counterpart:
\begin{theorem}\label{safe}
@{thm[mode=IfThen] safe}
\end{theorem}
Let us examine the proof of this theorem to show how it differs from
the state based version. For the core of the proof let
@{prop"s = s\<^sub>3 @ [Enter g' r (k,k')] @ s\<^sub>2 @ [Check_in g' r (k,k')] @ s\<^sub>1"}
and assume
@{prop"isin (s\<^sub>2 @ [Check_in g' r (k,k')] @ s\<^sub>1) r = {}"} (0). By induction on
\<open>s\<^sub>3\<close> we prove
@{prop[display]"\<lbrakk>hotel s; no_Check_in (s\<^sub>3 @ s\<^sub>2) r; g \<in> isin s r \<rbrakk> \<Longrightarrow> g' = g"}
The actual theorem follows by definition of @{const safe}.
The base case of the induction follows from (0). For the induction step let
@{prop"t = (e#s\<^sub>3) @ [Enter g' r (k,k')] @ s\<^sub>2 @ [Check_in g' r (k,k')] @ s\<^sub>1"}.
We assume @{prop"hotel t"}, @{prop"no_Check_in ((e#s\<^sub>3) @ s\<^sub>2) r"},
and @{prop"g \<in> isin s r"}, and show @{prop"g' = g"}.
The proof is by case distinction on the event \<open>e\<close>.
The cases @{const Check_in} and @{const Exit} follow directly from the
induction hypothesis because the set of occupants of \<open>r\<close>
can only decrease. Now we focus on the case @{prop"e = Enter g'' r' c"}.
If @{prop"r' \<noteq> r"} the set of occupants of \<open>r\<close> remains unchanged
and the claim follow directly from the induction hypothesis.
If @{prop"g'' \<noteq> g"} then \<open>g\<close> must already have been in \<open>r\<close>
before the \<open>Enter\<close> event and the claim again follows directly
from the induction hypothesis. Now assume @{prop"r' = r"}
and @{prop"g'' = g"}.
From @{prop"hotel t"} we obtain @{prop"hotel s"} (1) and
@{prop"c \<in> cards s g"} (2), and
from @{prop"no_Check_in (s\<^sub>3 @ s\<^sub>2) r"} and (0)
we obtain @{prop"safe s r"} (3). Let @{prop"c = (k\<^sub>1,k\<^sub>2)"}.
From Lemma~\ref{state-lemmas}.\ref{safe_roomk_currk} and
Lemma~\ref{app-lemmas}.\ref{currk_app} we obtain
\<open>roomk s r = currk s r = k'\<close>.
Hence @{prop"k\<^sub>1 \<noteq> roomk s r"} by
Lemma~\ref{trace-lemmas}.\ref{no_checkin_no_newkey}
using (1), (2) and @{prop"no_Check_in (s\<^sub>3 @ s\<^sub>2) r"}.
Hence @{prop"k\<^sub>2 = roomk s r"} by @{prop"hotel t"}.
With Lemma~\ref{state-lemmas}.\ref{safe_only_owner_enter_normal}
and (1--3) we obtain
@{prop"owns t r = \<lfloor>g\<rfloor>"}. At the same time we have @{prop"owns t r = \<lfloor>g'\<rfloor>"}
because @{prop"hotel t"} and @{prop"no_Check_in ((e # s\<^sub>3) @ s\<^sub>2) r"}: nobody
has checked in to room \<open>r\<close> after \<open>g'\<close>. Thus the claim
@{prop"g' = g"} follows.
The details of this proof differ from those of Theorem~\ref{safe-state}
but the structure is very similar.
\subsection{Eliminating \isa{isin}}
In the state based approach we needed @{const isin} to express our
safety guarantees. In the presence of traces, we can do away with it
and talk about @{const Enter} events instead. We show that if somebody
enters a safe room, he is the owner:
\begin{theorem}\label{Enter_safe}
@{thm[mode=IfThen] Enter_safe}
\end{theorem}
From @{prop"safe\<^sub>0 s r"} it follows that \<open>s\<close> must be of the form
@{term"s\<^sub>2 @ [Check_in g\<^sub>0 r c'] @ s\<^sub>1"} such that @{prop"no_Check_in s\<^sub>2 r"}.
Let @{prop"c = (x,y)"} and @{prop"c' = (k,k')"}.
By Lemma~\ref{state-lemmas}.\ref{safe_roomk_currk} we have
\<open>roomk s r = currk s r = k'\<close>.
From @{prop"hotel(Enter g r c # s)"} it follows that
@{prop"(x,y) \<in> cards s g"} and @{prop"k' \<in> {x,y}"}.
By Lemma~\ref{trace-lemmas}.\ref{no_checkin_no_newkey}
@{prop"x = k'"} would contradict @{prop"(x,y) \<in> cards s g"}.
Hence @{prop"y = k'"}.
With Lemma~\ref{state-lemmas}.\ref{safe_only_owner_enter_normal}
we obtain @{prop"owns s r = \<lfloor>g\<rfloor>"}.
Having dispensed with @{const isin} we could also eliminate @{const
Exit} to arrive at a model closer to the ones in~\<^cite>\<open>"Jackson06"\<close>.
Finally one may quibble that all the safety theorems proved so far
assume safety of the room at that point in time when somebody enters
it. That is, the owner of the room must be sure that once a room is
safe, it stays safe, in order to profit from those safety theorems.
Of course, this is the case as long as nobody else checks in to that room:
\begin{lemma}
@{thm[mode=IfThen]safe_future}
\end{lemma}
It follows easily that Theorem~\ref{Enter_safe} also extends until check-in:
\begin{corollary}
@{thm[mode=IfThen]Enter_safe_future}
\end{corollary}
\subsection{Completeness of @{const safe}}
Having proved correctness of @{const safe}, i.e.\ that safe behaviour
protects against intruders, one may wonder if @{const safe} is
complete, i.e.\ if it covers all safe behaviour, or if it is too
restrictive. It turns out that @{const safe} is incomplete for two
different reasons. The trivial one is that in case @{const initk} is
injective, every room is protected against intruders right from the
start. That is, @{term"[Check_in g r c]"} will only allow @{term g} to
enter \<open>r\<close> until somebody else checks in to \<open>r\<close>. The
second, more subtle incompleteness is that even if there are previous
owners of a room, it may be safe to enter a room with an old card
\<open>c\<close>: one merely needs to make sure that no other guest checked
in after the check-in where one obtained \<open>c\<close>. However,
formalizing this is not only messy, it is also somewhat pointless:
this liberalization is not something a guest can take advantage of
because there is no (direct) way he can find out which of his cards
meets this criterion. But without this knowledge, the only safe thing
to do is to make sure he has used his latest card. This incompleteness
applies to the state based model as well.
\<close>
(*<*)
end
(*>*)
|
{-# OPTIONS --without-K --exact-split --safe #-}
open import Fragment.Equational.Theory
module Fragment.Equational.Model.Base (Θ : Theory) where
open import Fragment.Equational.Model.Satisfaction {Σ Θ}
open import Fragment.Algebra.Algebra (Σ Θ) hiding (∥_∥/≈)
open import Fragment.Algebra.Free (Σ Θ)
open import Level using (Level; _⊔_; suc)
open import Function using (_∘_)
open import Data.Fin using (Fin)
open import Data.Nat using (ℕ)
open import Relation.Binary using (Setoid)
private
variable
a ℓ : Level
Models : Algebra {a} {ℓ} → Set (a ⊔ ℓ)
Models S = ∀ {n} → (eq : eqs Θ n) → S ⊨ (Θ ⟦ eq ⟧ₑ)
module _ (S : Setoid a ℓ) where
record IsModel : Set (a ⊔ ℓ) where
field
isAlgebra : IsAlgebra S
models : Models (algebra S isAlgebra)
open IsAlgebra isAlgebra public
record Model : Set (suc a ⊔ suc ℓ) where
field
∥_∥/≈ : Setoid a ℓ
isModel : IsModel ∥_∥/≈
∥_∥ₐ : Algebra
∥_∥ₐ = algebra ∥_∥/≈ (IsModel.isAlgebra isModel)
∥_∥ₐ-models : Models ∥_∥ₐ
∥_∥ₐ-models = IsModel.models isModel
open Algebra (algebra ∥_∥/≈ (IsModel.isAlgebra isModel))
hiding (∥_∥/≈) public
open Model public
|
lemma continuous_map_limit: assumes "continuous_map X Y g" and f: "limitin X f l F" shows "limitin Y (g \<circ> f) (g l) F" |
open import Prelude
module Implicits.Resolution.Stack.Resolution where
open import Coinduction
open import Data.Fin.Substitution
open import Implicits.Syntax
open import Implicits.Substitutions
open import Induction
open import Induction.Nat
open import Implicits.Resolution.Termination.Stack
infixl 5 _⊢ᵣ_
infixl 5 _&_⊢ᵣ_ _&_,_⊢_↓_
mutual
-- Δ & s , r ⊢ a ↓ τ denotes:
-- Under the context Δ, with stack of resolution goals s, the type a yields simple type τ.
-- 'r' is used to keep track of the rule from the context that yielded 'a'
-- ('a' is getting recursively refined)
data _&_,_⊢_↓_ {ν} (Δ : ICtx ν) :
∀ {r} → Stack Δ → r List.∈ Δ → Type ν → SimpleType ν → Set where
i-simp : ∀ {r s} {r∈Δ : r List.∈ Δ} a → Δ & s , r∈Δ ⊢ simpl a ↓ a
i-iabs : ∀ {ρ₁ ρ₂ a r s} {r∈Δ : r List.∈ Δ} →
ρ₁ for r∈Δ ⊬dom s → -- subproblems decrease when recursing
Δ & (s push ρ₁ for r∈Δ) ⊢ᵣ ρ₁ → -- domain is resolvable
Δ & s , r∈Δ ⊢ ρ₂ ↓ a → -- codomain matches
Δ & s , r∈Δ ⊢ ρ₁ ⇒ ρ₂ ↓ a
i-tabs : ∀ {ρ a r s} {r∈Δ : r List.∈ Δ} b →
Δ & s , r∈Δ ⊢ ρ tp[/tp b ] ↓ a → Δ & s , r∈Δ ⊢ ∀' ρ ↓ a
data _&_⊢ᵣ_ {ν} (Δ : ICtx ν) : Stack Δ → Type ν → Set where
r-simp : ∀ {r τ s} → (r∈Δ : r List.∈ Δ) → Δ & s , r∈Δ ⊢ r ↓ τ → Δ & s ⊢ᵣ simpl τ
r-iabs : ∀ {ρ₁ ρ₂} {s : Stack Δ} → ((ρ₁ List.∷ Δ) & (s prepend ρ₁) ⊢ᵣ ρ₂) →
Δ & s ⊢ᵣ (ρ₁ ⇒ ρ₂)
r-tabs : ∀ {ρ s} → ictx-weaken Δ & stack-weaken s ⊢ᵣ ρ → Δ & s ⊢ᵣ ∀' ρ
-- TODO: This doesn't hold.
-- e.g. we can unify (a → b) with the codomain of a rule (a → b → a) ⇒ (a → b)
-- so the subgoal is larger than the initial goal.
--
-- We instantiate the stack with types that act as 'infinity' on the goal.
-- Every possible 'subgoal' we encounter and push to the stack will certainly
-- be smaller than r
_⊢ᵣ_ : ∀ {ν} → ICtx ν → Type ν → Set
Δ ⊢ᵣ r = Δ & All.tabulate (const r) ⊢ᵣ r
|
module Text.Markup.Edda.Model
import public Text.Markup.Edda.Model.Common
import public Text.Markup.Edda.Model.Raw
import public Text.Markup.Edda.Model.Processed
|
Formal statement is: lemma bounded_imp_bdd_below: "bounded S \<Longrightarrow> bdd_below (S :: real set)" Informal statement is: If $S$ is a bounded set of real numbers, then $S$ is bounded below. |
[STATEMENT]
lemma block_conj_cong: "(P \<and> Q) = (P \<and> Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (P \<and> Q) = (P \<and> Q)
[PROOF STEP]
by simp |
Formal statement is: lemma pderiv_pcompose: "pderiv (pcompose p q) = pcompose (pderiv p) q * pderiv q" Informal statement is: The derivative of the composition of two polynomials is the composition of the derivatives of the two polynomials, multiplied by the derivative of the second polynomial. |
import Data.Vect
createEmpties : Vect n (Vect 0 elem)
createEmpties = replicate _ []
transposeMat : Vect m (Vect n elem) -> Vect n (Vect m elem)
transposeMat [] = createEmpties
transposeMat (x :: xs) = let xsTrans = transposeMat xs in
zipWith (\el, vect => el :: vect) x xsTrans
addMatrix : Num a => Vect n (Vect m a) -> Vect n (Vect m a) -> Vect n (Vect m a)
addMatrix [] [] = []
addMatrix (x :: xs) (y :: ys) = zipWith (\a, b => a + b) x y :: addMatrix xs ys
computeRow : Num a => Vect m a -> Vect k (Vect m a) -> Vect k a
computeRow xs [] = []
computeRow xs (y :: ys) = sum (zipWith (*) xs y) :: computeRow xs ys
multMatrix: Num a => Vect n (Vect m a) -> Vect m (Vect k a) -> Vect n (Vect k a)
multMatrix [] ys = []
multMatrix (x :: xs) ys = let rightTrans = transposeMat ys in
computeRow x rightTrans :: multMatrix xs ys
|
(*
* Copyright 2019, NTU
*
* This software may be distributed and modified according to the terms of
* the BSD 2-Clause license. Note that NO WARRANTY is provided.
* See "LICENSE_BSD2.txt" for details.
*
* Author: Albert Rizaldi, NTU Singapore
*)
theory Dflipflop_Typed
imports VHDL_Hoare_Typed
begin
text \<open>datatype for all signals\<close>
datatype sig = D | CLK | OUT
definition dflipflop :: "sig conc_stmt" where
"dflipflop \<equiv> process {CLK} : Bguarded (Bsig CLK) (Bassign_trans OUT (Bsig D) 1) Bnull"
text \<open>The following positive edge is only defined for a scalar signal.\<close>
abbreviation is_posedge2 :: "'signal worldline_init \<Rightarrow> 'signal \<Rightarrow> nat \<Rightarrow> bool" where
"is_posedge2 w s j \<equiv> (snd w s (j - 1) = Bv False \<and> snd w s j = Bv True)"
locale ff_typed =
fixes \<Gamma> :: "sig tyenv"
assumes tyd: "\<Gamma> D = Bty" and tyclk: "\<Gamma> CLK = Bty" and tyout: "\<Gamma> OUT = Bty"
begin
definition inv :: "sig assn2" where
"inv tw \<equiv> 1 < fst tw \<longrightarrow> wline_of tw OUT (fst tw) = (if is_posedge2 (snd tw) CLK (fst tw - 1) then wline_of tw D (fst tw - 1) else wline_of tw OUT (fst tw - 1))"
definition inv2 :: "sig assn2" where
"inv2 tw \<equiv> disjnt {CLK} (event_of tw) \<or> wline_of tw CLK (fst tw) \<noteq> (Bv True) \<longrightarrow> (\<forall>i > fst tw. wline_of tw OUT i = wline_of tw OUT (fst tw))"
lemma conc_stmt_wf_mult:
"conc_stmt_wf dflipflop"
unfolding dflipflop_def conc_stmt_wf_def by auto
lemma nonneg_delay_conc_mult:
"nonneg_delay_conc dflipflop"
unfolding dflipflop_def by auto
lemma nonneg_delay_conc_mult':
" nonneg_delay_conc ( process {CLK} : Bguarded (Bsig CLK) (Bassign_trans OUT (Bsig D) 1) Bnull)"
using nonneg_delay_conc_mult unfolding dflipflop_def by auto
lemma well_typed:
"seq_wt \<Gamma> (Bguarded (Bsig CLK) (Bassign_trans OUT (Bsig D) 1) Bnull)"
by (metis bexp_wt.intros(3) seq_wt.intros(1) seq_wt.intros(3) seq_wt.intros(4) tyclk tyd tyout)
lemma conc_wt_mult:
"conc_wt \<Gamma> dflipflop"
unfolding dflipflop_def by (meson conc_wt.intros(1) well_typed)
lemma conc_wt_mult':
"conc_wt \<Gamma> ( process {CLK} : Bguarded (Bsig CLK) (Bassign_trans OUT (Bsig D) 1) Bnull)"
using conc_wt_mult unfolding dflipflop_def by auto
lemma inv_next_time:
fixes tw
assumes "\<not> disjnt {CLK} (event_of tw)"
defines "v \<equiv> eval_world_raw2 tw (Bsig D)"
assumes "eval_world_raw2 tw (Bsig CLK) = Bv True"
defines "tw' \<equiv> tw[OUT, 1 :=\<^sub>2 v]"
assumes "wityping \<Gamma> (snd tw)"
assumes "inv tw"
shows "inv (fst tw' + 1, snd tw')"
proof -
{ assume "1 < fst tw' + 1"
hence "0 < fst tw"
unfolding tw'_def worldline_upd2_def worldline_upd_def by auto
have bexpIN1: "bexp_wt \<Gamma> (Bsig CLK) (Bty)"
using ff_typed_axioms unfolding ff_typed_def by (metis bexp_wt.intros(3))+
have *: "wline_of tw CLK (fst tw) \<noteq> wline_of tw CLK (fst tw - 1)"
using assms(1) `0 < fst tw` unfolding event_of_alt_def by auto
have **: "wline_of tw CLK (fst tw) = Bv True"
using assms(3) by auto
have "is_posedge2 (snd tw) CLK (fst tw)"
proof -
from * have neq: "wline_of tw CLK (fst tw) \<noteq> wline_of tw CLK (fst tw - 1)"
by auto
obtain bool where "wline_of tw CLK (fst tw - 1) = Bv bool"
using eval_world_raw_bv[OF bexpIN1 `wityping \<Gamma> (snd tw)`, of "fst tw - 1"] by auto
then show ?thesis
using ** neq by auto
qed
have "wline_of tw' OUT (fst tw + 1) = v"
unfolding tw'_def worldline_upd2_def worldline_upd_def by auto
also have "... = wline_of tw D (fst tw)"
using assms(2) unfolding v_def eval_world_raw.simps eval_arith.simps Let_def comp_def by auto
also have "... = (if is_posedge2 (snd tw) CLK (fst tw) then wline_of tw D (fst tw) else wline_of tw OUT (fst tw))"
using `is_posedge2 (snd tw) CLK (fst tw)` by auto
finally have "wline_of tw' OUT (fst tw + 1) = (if is_posedge2 (snd tw) CLK (fst tw) then wline_of tw D (fst tw) else wline_of tw OUT (fst tw))"
by auto }
thus ?thesis
unfolding inv_def tw'_def worldline_upd2_def worldline_upd_def by fastforce
qed
lemma inv2_next_time:
fixes tw v
defines "tw' \<equiv> tw[OUT, 1 :=\<^sub>2 v]"
shows "inv2 (fst tw' + 1, snd tw')"
unfolding inv2_def tw'_def worldline_upd2_def worldline_upd_def by auto
lemma conc_hoare:
"\<And>tw. inv tw \<and> inv2 tw \<and> (disjnt {CLK} (event_of tw) \<or> wline_of tw CLK (fst tw) \<noteq> (Bv True)) \<Longrightarrow> inv (fst tw + 1, snd tw)"
proof -
fix tw
assume "inv tw \<and> inv2 tw \<and> (disjnt {CLK} (event_of tw) \<or> wline_of tw CLK (fst tw) \<noteq> (Bv True))"
hence "inv tw" and "inv2 tw" and "disjnt {CLK} (event_of tw) \<or> wline_of tw CLK (fst tw) \<noteq> (Bv True)"
by auto
{ assume "1 < fst tw"
have "wline_of tw OUT (fst tw + 1) = wline_of tw OUT (fst tw)"
using `inv2 tw` `disjnt {CLK} (event_of tw) \<or> wline_of tw CLK (fst tw) \<noteq> (Bv True)` unfolding inv2_def by auto
also have *: "... = (if is_posedge2 (snd tw) CLK (get_time tw - 1) then wline_of tw D (get_time tw - 1) else wline_of tw OUT (get_time tw - 1))"
using `inv tw` `1 < fst tw` unfolding inv_def by auto
also have "... = (if is_posedge2 (snd tw) CLK (get_time tw) then wline_of tw D (get_time tw) else wline_of tw OUT (get_time tw))"
using `disjnt {CLK} (event_of tw) \<or> wline_of tw CLK (fst tw) \<noteq> (Bv True)` unfolding event_of_alt_def using *
by (smt comp_apply diff_is_0_eq' disjnt_insert1 le_numeral_extra(1) mem_Collect_eq val.inject(1))
finally have "wline_of tw OUT (fst tw + 1) = (if is_posedge2 (snd tw) CLK (get_time tw) then wline_of tw D (get_time tw) else wline_of tw OUT (get_time tw))"
by auto }
thus "inv (fst tw + 1, snd tw)"
unfolding inv_def using \<open>local.inv tw\<close> local.inv_def
by (smt \<open>local.inv tw \<and> inv2 tw \<and> (disjnt {CLK} (event_of tw) \<or> wline_of tw CLK (get_time tw) \<noteq>
Bv True)\<close> add_diff_cancel_right' comp_def disjnt_insert1 event_of_alt_def1 fst_conv inv2_def
less_add_one mem_Collect_eq snd_conv val.inject(1) zero_less_diff)
qed
lemma conc_hoare2:
"\<And>tw. inv2 tw \<and> (disjnt {CLK} (event_of tw) \<or> wline_of tw CLK (fst tw) \<noteq> (Bv True)) \<Longrightarrow> inv2 (fst tw + 1, snd tw)"
unfolding inv2_def by auto
lemma conc_sim2':
"\<Gamma> \<turnstile>\<^sub>s \<lbrace>\<lambda>tw. inv tw \<and> inv2 tw\<rbrace> dflipflop \<lbrace>\<lambda>tw. inv tw \<and> inv2 tw\<rbrace>"
apply (rule While_Suc)
apply (rule Conseq'[where P="wp3_conc \<Gamma> dflipflop (\<lambda>tw. inv (fst tw + 1, snd tw) \<and>
inv2 (fst tw + 1, snd tw))", rotated])
apply (rule wp3_conc_is_pre, rule conc_stmt_wf_mult, rule nonneg_delay_conc_mult, rule conc_wt_mult, simp)
unfolding dflipflop_def wp3_conc_single'[OF conc_wt_mult' nonneg_delay_conc_mult'] wp3_fun.simps
using inv_next_time inv2_next_time conc_hoare conc_hoare2 by auto
subsection \<open>Initialisation satisfies @{term "inv"} and @{term "inv2"}\<close>
lemma nonneg_delay:
"nonneg_delay ( Bguarded (Bsig CLK) (Bassign_trans OUT (Bsig D) 1) Bnull)"
using nonneg_delay_conc_mult' by auto
lemma inv_next_time0:
assumes "fst tw = 0"
defines "v \<equiv> eval_world_raw2 tw (Bsig D)"
defines "tw' \<equiv> tw[ OUT, 1 :=\<^sub>2 v]"
shows "inv (fst tw' + 1, snd tw')"
unfolding inv_def by (simp add: assms(1) tw'_def)
lemma inv2_next_time0:
assumes "fst tw = 0"
assumes "eval_world_raw2 tw (Bsig CLK) \<noteq> Bv True"
assumes "\<forall>i. wline_of tw OUT i = wline_of tw OUT 0"
shows "inv2 (fst tw + 1, snd tw)"
using assms unfolding inv2_def by (metis comp_apply snd_conv)
lemma inv_next_time0'':
assumes "fst tw = 0"
shows "inv (fst tw + 1, snd tw)"
unfolding inv_def by (simp add: assms(1))
lemma init_sat_nand_inv_comb:
"init_sim2_hoare_wt \<Gamma> (\<lambda>tw. fst tw = 0 \<and> (\<forall>i. wline_of tw OUT i = wline_of tw OUT 0)) dflipflop (\<lambda>tw. inv tw \<and> inv2 tw)"
unfolding dflipflop_def
apply (rule AssignI_suc, rule SingleI)
apply (rule Conseq3[where Q="\<lambda>tw. inv (fst tw + 1, snd tw) \<and> inv2 (fst tw + 1, snd tw)", rotated])
apply (rule wp3_fun_is_pre[OF well_typed nonneg_delay], simp)
unfolding wp3_fun.simps using inv_next_time inv2_next_time inv_next_time0 inv2_next_time0 inv_next_time0''
by auto
lemma
assumes "sim_fin2 w (i + 2) dflipflop tw'"
assumes "\<forall>i. wline_of (0, w) OUT i = wline_of (0, w) OUT 0"
assumes " conc_wt \<Gamma> dflipflop" and "wityping \<Gamma> w"
shows "wline_of tw' OUT (i + 2) = (if is_posedge2 (snd tw') CLK (i + 1) then wline_of tw' D (i + 1) else wline_of tw' OUT (i + 1))"
using grand_correctness2[OF assms(1) assms(4) conc_stmt_wf_mult conc_wt_mult nonneg_delay_conc_mult conc_sim2' assms(2) init_sat_nand_inv_comb]
unfolding inv_def
by (metis (no_types, lifting) add.assoc add_diff_cancel_right' assms(1) discrete le_add2 one_add_one sim_fin2.cases world_maxtime_lt_fst_tres)
end |
lemma homotopically_trivial_retraction_gen: assumes P: "\<And>f. \<lbrakk>continuous_on U f; f ` U \<subseteq> t; Q f\<rbrakk> \<Longrightarrow> P(k \<circ> f)" and Q: "\<And>f. \<lbrakk>continuous_on U f; f ` U \<subseteq> s; P f\<rbrakk> \<Longrightarrow> Q(h \<circ> f)" and Qeq: "\<And>h k. (\<And>x. x \<in> U \<Longrightarrow> h x = k x) \<Longrightarrow> Q h = Q k" and hom: "\<And>f g. \<lbrakk>continuous_on U f; f ` U \<subseteq> s; P f; continuous_on U g; g ` U \<subseteq> s; P g\<rbrakk> \<Longrightarrow> homotopic_with_canon P U s f g" and contf: "continuous_on U f" and imf: "f ` U \<subseteq> t" and Qf: "Q f" and contg: "continuous_on U g" and img: "g ` U \<subseteq> t" and Qg: "Q g" shows "homotopic_with_canon Q U t f g" |
(* Full safety for STLC *)
(* values well-typed with respect to runtime environment *)
(* inversion lemma structure *)
Require Export SfLib.
Require Export Arith.EqNat.
Require Export Arith.Le.
Module STLC.
Definition id := nat.
Inductive ty : Type :=
| TBool : ty
| TFun : ty -> ty -> ty
.
Inductive tm : Type :=
| ttrue : tm
| tfalse : tm
| tvar : id -> tm
| tapp : tm -> tm -> tm (* f(x) *)
| tabs : tm -> tm (* \f x.y *)
.
Inductive vl : Type :=
| vbool : bool -> vl
| vabs : list vl -> tm -> vl
.
Definition venv := list vl.
Definition tenv := list ty.
Hint Unfold venv.
Hint Unfold tenv.
Fixpoint length {X: Type} (l : list X): nat :=
match l with
| [] => 0
| _::l' => 1 + length l'
end.
Fixpoint index {X : Type} (n : id) (l : list X) : option X :=
match l with
| [] => None
| a :: l' => if beq_nat n (length l') then Some a else index n l'
end.
Inductive has_type : tenv -> tm -> ty -> Prop :=
| t_true: forall env,
has_type env ttrue TBool
| t_false: forall env,
has_type env tfalse TBool
| t_var: forall x env T1,
index x env = Some T1 ->
has_type env (tvar x) T1
| t_app: forall env f x T1 T2,
has_type env f (TFun T1 T2) ->
has_type env x T1 ->
has_type env (tapp f x) T2
| t_abs: forall env y T1 T2,
has_type (T1::(TFun T1 T2)::env) y T2 ->
has_type env (tabs y) (TFun T1 T2)
.
Inductive wf_env : venv -> tenv -> Prop :=
| wfe_nil : wf_env nil nil
| wfe_cons : forall v t vs ts,
val_type (v::vs) v t ->
wf_env vs ts ->
wf_env (cons v vs) (cons t ts)
with val_type : venv -> vl -> ty -> Prop :=
| v_bool: forall venv b,
val_type venv (vbool b) TBool
| v_abs: forall env venv tenv y T1 T2,
wf_env venv tenv ->
has_type (T1::(TFun T1 T2)::tenv) y T2 ->
val_type env (vabs venv y) (TFun T1 T2)
.
Inductive stp: venv -> ty -> venv -> ty -> Prop :=
| stp_refl: forall G1 G2 T,
stp G1 T G2 T.
(*
None means timeout
Some None means stuck
Some (Some v)) means result v
Could use do-notation to clean up syntax.
*)
Fixpoint teval(n: nat)(env: venv)(t: tm){struct n}: option (option vl) :=
match n with
| 0 => None
| S n =>
match t with
| ttrue => Some (Some (vbool true))
| tfalse => Some (Some (vbool false))
| tvar x => Some (index x env)
| tabs y => Some (Some (vabs env y))
| tapp ef ex =>
match teval n env ex with
| None => None
| Some None => Some None
| Some (Some vx) =>
match teval n env ef with
| None => None
| Some None => Some None
| Some (Some (vbool _)) => Some None
| Some (Some (vabs env2 ey)) =>
teval n (vx::(vabs env2 ey)::env2) ey
end
end
end
end.
Hint Constructors ty.
Hint Constructors tm.
Hint Constructors vl.
Hint Constructors has_type.
Hint Constructors val_type.
Hint Constructors wf_env.
Hint Constructors option.
Hint Constructors list.
Hint Unfold index.
Hint Unfold length.
Hint Resolve ex_intro.
Lemma wf_length : forall vs ts,
wf_env vs ts ->
(length vs = length ts).
Proof.
intros. induction H. auto.
assert ((length (v::vs)) = 1 + length vs). constructor.
assert ((length (t::ts)) = 1 + length ts). constructor.
rewrite IHwf_env in H1. auto.
Qed.
Hint Immediate wf_length.
Lemma index_max : forall X vs n (T: X),
index n vs = Some T ->
n < length vs.
Proof.
intros X vs. induction vs.
Case "nil". intros. inversion H.
Case "cons".
intros. inversion H.
case_eq (beq_nat n (length vs)); intros E.
SCase "hit".
rewrite E in H1. inversion H1. subst.
eapply beq_nat_true in E.
unfold length. unfold length in E. rewrite E. eauto.
SCase "miss".
rewrite E in H1.
assert (n < length vs). eapply IHvs. apply H1.
compute. eauto.
Qed.
Lemma valtp_extend : forall vs v v1 T,
val_type vs v T ->
val_type (v1::vs) v T.
Proof. intros. induction H; eauto. Qed.
Lemma index_extend : forall X vs n a (T: X),
index n vs = Some T ->
index n (a::vs) = Some T.
Proof.
intros.
assert (n < length vs). eapply index_max. eauto.
assert (n <> length vs). omega.
assert (beq_nat n (length vs) = false) as E. eapply beq_nat_false_iff; eauto.
unfold index. unfold index in H. rewrite H. rewrite E. reflexivity.
Qed.
Lemma index_safe_ex: forall H1 G1 TF i,
wf_env H1 G1 ->
index i G1 = Some TF ->
exists v, index i H1 = Some v /\ val_type H1 v TF.
Proof. intros. induction H.
Case "nil". inversion H0.
Case "cons". inversion H0.
case_eq (beq_nat i (length ts)).
SCase "hit".
intros E.
rewrite E in H3. inversion H3. subst t.
assert (beq_nat i (length vs) = true). eauto.
assert (index i (v :: vs) = Some v). eauto. unfold index. rewrite H2. eauto.
eauto.
SCase "miss".
intros E.
assert (beq_nat i (length vs) = false). eauto.
rewrite E in H3.
assert (exists v0, index i vs = Some v0 /\ val_type vs v0 TF) as HI. eapply IHwf_env. eauto.
inversion HI as [v0 HI1]. inversion HI1.
eexists. econstructor. eapply index_extend; eauto. eapply valtp_extend; eauto.
Qed.
Inductive res_type: venv -> option vl -> ty -> Prop :=
| not_stuck: forall venv v T,
val_type venv v T ->
res_type venv (Some v) T.
Hint Constructors res_type.
Hint Resolve not_stuck.
Lemma valtp_widen: forall vf H1 H2 T1 T2,
val_type H1 vf T1 ->
stp H1 T1 H2 T2 ->
val_type H2 vf T2.
Proof.
intros. inversion H; inversion H0; subst T2; subst; eauto.
Qed.
Lemma invert_abs: forall venv vf vx T1 T2,
val_type venv vf (TFun T1 T2) ->
exists env tenv y T3 T4,
vf = (vabs env y) /\
wf_env env tenv /\
has_type (T3::(TFun T3 T4)::tenv) y T4 /\
stp venv T1 (vx::vf::env) T3 /\
stp (vx::vf::env) T4 venv T2.
Proof.
intros. inversion H. repeat eexists; repeat eauto.
Qed.
(* if not a timeout, then result not stuck and well-typed *)
Theorem full_safety : forall n e tenv venv res T,
teval n venv e = Some res -> has_type tenv e T -> wf_env venv tenv ->
res_type venv res T.
Proof.
intros n. induction n.
(* 0 *) intros. inversion H.
(* S n *) intros. destruct e; inversion H; inversion H0.
Case "True". eapply not_stuck. eapply v_bool.
Case "False". eapply not_stuck. eapply v_bool.
Case "Var".
destruct (index_safe_ex venv0 tenv0 T i) as [v [I V]]; eauto.
rewrite I. eapply not_stuck. eapply V.
Case "App".
remember (teval n venv0 e1) as tf.
remember (teval n venv0 e2) as tx.
subst T.
destruct tx as [rx|]; try solve by inversion.
assert (res_type venv0 rx T1) as HRX. SCase "HRX". subst. eapply IHn; eauto.
inversion HRX as [? vx].
destruct tf as [rf|]; subst rx; try solve by inversion.
assert (res_type venv0 rf (TFun T1 T2)) as HRF. SCase "HRF". subst. eapply IHn; eauto.
inversion HRF as [? vf].
destruct (invert_abs venv0 vf vx T1 T2) as
[env1 [tenv [y0 [T3 [T4 [EF [WF [HTY [STX STY]]]]]]]]]. eauto.
(* now we know it's a closure, and we have has_type evidence *)
assert (res_type (vx::vf::env1) res T4) as HRY.
SCase "HRY".
subst. eapply IHn. eauto. eauto.
(* wf_env f x *) econstructor. eapply valtp_widen; eauto.
(* wf_env f *) econstructor. eapply v_abs; eauto.
eauto.
inversion HRY as [? vy].
eapply not_stuck. eapply valtp_widen; eauto.
Case "Abs". intros. inversion H. inversion H0.
eapply not_stuck. eapply v_abs; eauto.
Qed.
End STLC. |
/*********************************************************************
* Software License Agreement (BSD License)
*
* Copyright (c) 2011, Willow Garage, Inc.
* 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 Willow Garage 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.
*********************************************************************/
/* Author: Ioan Sucan, Mathias Lüdtke, Dave Coleman */
// MoveIt
#include <moveit/rdf_loader/rdf_loader.h>
// ROS 2
#include <rclcpp/rclcpp.hpp>
#include <std_msgs/msg/string.hpp>
#include <ament_index_cpp/get_package_prefix.hpp>
#include <ament_index_cpp/get_package_share_directory.hpp>
// Boost
#include <boost/filesystem.hpp>
// C++
#include <fstream>
#include <streambuf>
#include <algorithm>
#include <chrono>
namespace rdf_loader
{
static const rclcpp::Logger LOGGER = rclcpp::get_logger("moveit_rdf_loader.rdf_loader");
RDFLoader::RDFLoader(const std::shared_ptr<rclcpp::Node>& node, const std::string& ros_name,
bool default_continuous_value, double default_timeout)
: ros_name_(ros_name)
{
auto start = node->now();
urdf_string_ =
urdf_ssp_.loadInitialValue(node, ros_name, std::bind(&RDFLoader::urdfUpdateCallback, this, std::placeholders::_1),
default_continuous_value, default_timeout);
const std::string srdf_name = ros_name + "_semantic";
srdf_string_ = srdf_ssp_.loadInitialValue(node, srdf_name,
std::bind(&RDFLoader::srdfUpdateCallback, this, std::placeholders::_1),
default_continuous_value, default_timeout);
if (!loadFromStrings())
{
return;
}
RCLCPP_INFO_STREAM(LOGGER, "Loaded robot model in " << (node->now() - start).seconds() << " seconds");
}
RDFLoader::RDFLoader(const std::string& urdf_string, const std::string& srdf_string)
: urdf_string_(urdf_string), srdf_string_(srdf_string)
{
if (!loadFromStrings())
{
return;
}
}
bool RDFLoader::loadFromStrings()
{
std::unique_ptr<urdf::Model> urdf = std::make_unique<urdf::Model>();
if (!urdf->initString(urdf_string_))
{
RCLCPP_INFO(LOGGER, "Unable to parse URDF");
return false;
}
srdf::ModelSharedPtr srdf = std::make_shared<srdf::Model>();
if (!srdf->initString(*urdf, srdf_string_))
{
RCLCPP_ERROR(LOGGER, "Unable to parse SRDF");
return false;
}
urdf_ = std::move(urdf);
srdf_ = std::move(srdf);
return true;
}
bool RDFLoader::isXacroFile(const std::string& path)
{
std::string lower_path = path;
std::transform(lower_path.begin(), lower_path.end(), lower_path.begin(), ::tolower);
return lower_path.find(".xacro") != std::string::npos;
}
bool RDFLoader::loadFileToString(std::string& buffer, const std::string& path)
{
if (path.empty())
{
RCLCPP_ERROR(LOGGER, "Path is empty");
return false;
}
if (!boost::filesystem::exists(path))
{
RCLCPP_ERROR(LOGGER, "File does not exist");
return false;
}
std::ifstream stream(path.c_str());
if (!stream.good())
{
RCLCPP_ERROR(LOGGER, "Unable to load path");
return false;
}
// Load the file to a string using an efficient memory allocation technique
stream.seekg(0, std::ios::end);
buffer.reserve(stream.tellg());
stream.seekg(0, std::ios::beg);
buffer.assign((std::istreambuf_iterator<char>(stream)), std::istreambuf_iterator<char>());
stream.close();
return true;
}
bool RDFLoader::loadXacroFileToString(std::string& buffer, const std::string& path,
const std::vector<std::string>& xacro_args)
{
buffer.clear();
if (path.empty())
{
RCLCPP_ERROR(LOGGER, "Path is empty");
return false;
}
if (!boost::filesystem::exists(path))
{
RCLCPP_ERROR(LOGGER, "File does not exist");
return false;
}
std::string cmd = "ros2 run xacro xacro";
for (const std::string& xacro_arg : xacro_args)
cmd += xacro_arg + " ";
cmd += path;
#ifdef _WIN32
FILE* pipe = _popen(cmd.c_str(), "r");
#else
FILE* pipe = popen(cmd.c_str(), "r");
#endif
if (!pipe)
{
RCLCPP_ERROR(LOGGER, "Unable to load path");
return false;
}
char pipe_buffer[128];
while (!feof(pipe))
{
if (fgets(pipe_buffer, 128, pipe) != nullptr)
buffer += pipe_buffer;
}
#ifdef _WIN32
_pclose(pipe);
#else
pclose(pipe);
#endif
return true;
}
bool RDFLoader::loadXmlFileToString(std::string& buffer, const std::string& path,
const std::vector<std::string>& xacro_args)
{
if (isXacroFile(path))
{
return loadXacroFileToString(buffer, path, xacro_args);
}
return loadFileToString(buffer, path);
}
bool RDFLoader::loadPkgFileToString(std::string& buffer, const std::string& package_name,
const std::string& relative_path, const std::vector<std::string>& xacro_args)
{
std::string package_path;
try
{
package_path = ament_index_cpp::get_package_share_directory(package_name);
}
catch (const ament_index_cpp::PackageNotFoundError& e)
{
RCLCPP_ERROR(LOGGER, "ament_index_cpp: %s", e.what());
return false;
}
boost::filesystem::path path(package_path);
// Use boost to cross-platform combine paths
path = path / relative_path;
return loadXmlFileToString(buffer, path.string(), xacro_args);
}
void RDFLoader::urdfUpdateCallback(const std::string& new_urdf_string)
{
urdf_string_ = new_urdf_string;
if (!loadFromStrings())
{
return;
}
if (new_model_cb_)
{
new_model_cb_();
}
}
void RDFLoader::srdfUpdateCallback(const std::string& new_srdf_string)
{
srdf_string_ = new_srdf_string;
if (!loadFromStrings())
{
return;
}
if (new_model_cb_)
{
new_model_cb_();
}
}
} // namespace rdf_loader
|
Formal statement is: lemma islimpt_greaterThanLessThan2: fixes a b::"'a::{linorder_topology, dense_order}" assumes "a < b" shows "b islimpt {a<..<b}" Informal statement is: If $a < b$, then $b$ is a limit point of the open interval $(a,b)$. |
theory Kozen_Example
imports SKAT_Tactics List
begin
(* Kozen and Angus's example *)
datatype kzp = f_kzp | g_kzp | P_kzp | bot_kzp | x_kzp
lemma kzp_UNIV: "UNIV = {P_kzp,f_kzp,g_kzp,bot_kzp,x_kzp}"
by (auto, metis kzp.exhaust)
instantiation kzp :: ranked_alphabet
begin
fun arity_kzp :: "kzp \<Rightarrow> nat" where
"arity_kzp f_kzp = 1"
| "arity_kzp g_kzp = 2"
| "arity_kzp P_kzp = 1"
| "arity_kzp bot_kzp = 0"
| "arity_kzp x_kzp = 0"
definition funs_kzp :: "kzp set" where "funs_kzp \<equiv> {f_kzp, g_kzp, bot_kzp, x_kzp}"
definition rels_kzp :: "kzp set" where "rels_kzp \<equiv> {P_kzp}"
definition NULL_kzp :: "kzp" where "NULL_kzp \<equiv> bot_kzp"
declare funs_kzp_def [alphabet]
and rels_kzp_def [alphabet]
and NULL_kzp_def [alphabet]
definition output_vars_kzp :: "kzp itself \<Rightarrow> nat set" where "output_vars_kzp x \<equiv> {0}"
declare output_vars_kzp_def [alphabet]
instance proof
show "(funs :: kzp set) \<inter> rels = {}"
by (simp add: funs_kzp_def rels_kzp_def)
show "(funs :: kzp set) \<union> rels = UNIV"
by (simp add: funs_kzp_def rels_kzp_def kzp_UNIV)
show "(funs :: kzp set) \<noteq> {}"
by (simp add: funs_kzp_def)
show "(rels :: kzp set) \<noteq> {}"
by (simp add: rels_kzp_def)
show "NULL \<in> (funs :: kzp set)"
by (simp add: NULL_kzp_def funs_kzp_def)
show "arity (NULL::kzp) = 0"
by (simp add: NULL_kzp_def)
show "\<exists>x. x \<in> output_vars TYPE(kzp)"
by (metis (mono_tags) insertI1 output_vars_kzp_def)
show "finite (output_vars TYPE(kzp))"
by (metis (hide_lams, mono_tags) atLeastLessThan0 finite_atLeastLessThan finite_insert output_vars_kzp_def)
qed
end
definition f :: "kzp trm \<Rightarrow> kzp trm" where
"f x \<equiv> App f_kzp [x]"
definition g :: "kzp trm \<Rightarrow> kzp trm \<Rightarrow> kzp trm" where
"g x y \<equiv> App g_kzp [x, y]"
definition P :: "kzp trm \<Rightarrow> kzp skat" where
"P x \<equiv> pred (Pred P_kzp [x])"
definition vx :: "kzp trm " where
"vx \<equiv> App x_kzp []"
definition bot :: "kzp trm" where
"bot \<equiv> App bot_kzp []"
declare f_def [skat_simp]
and g_def [skat_simp]
and bot_def [skat_simp]
and P_def [skat_simp]
and vx_def [skat_simp]
(* Sequences *)
abbreviation loop where "loop v \<equiv> skat_star (seq v)"
(* Useful lemmas *)
(* Sliding *)
lemma seq_slide:
assumes xs_def: "xs = drop n ys"
shows "seq xs\<cdot>(seq ys)\<^sup>\<star> = (seq (xs @ take n ys))\<^sup>\<star>\<cdot>seq xs"
proof -
have "seq xs \<cdot> (seq (take n ys) \<cdot> seq xs)\<^sup>\<star> = (seq xs \<cdot> seq (take n ys))\<^sup>\<star> \<cdot> seq xs"
by (simp add: ska.star_slide[simplified,symmetric])
thus ?thesis
by (metis append_take_drop_id assms seq_mult)
qed
(* Shorthand notation *)
definition a :: "nat \<Rightarrow> kzp skat" where
"a i \<equiv> P (Var i)"
abbreviation a1 where "a1 \<equiv> a 1"
abbreviation a2 where "a2 \<equiv> a 2"
abbreviation a3 where "a3 \<equiv> a 3"
abbreviation a4 where "a4 \<equiv> a 4"
declare a_def [skat_simp]
lemma a_test [intro]: "a n \<in> carrier tests"
by (simp add: a_def P_def, rule pred_closed)
lemma a_comm: "a n \<cdot> a m = a m \<cdot> a n"
by skat_comm
lemma a_assign: "n \<noteq> m \<Longrightarrow> a n \<cdot> m := x = m := x \<cdot> a n"
by skat_comm
definition b :: "nat \<Rightarrow> kzp skat" where
"b i \<equiv> P (f (Var i))"
declare b_def [skat_simp]
definition c :: "nat \<Rightarrow> kzp skat" where
"c i \<equiv> P (f (f (Var i)))"
abbreviation c2 where "c2 \<equiv> c 2"
declare c_def [skat_simp]
definition p :: "nat \<Rightarrow> nat \<Rightarrow> kzp skat" where
"p i j \<equiv> i := f (Var j)"
declare p_def [skat_simp]
abbreviation p41 where "p41 \<equiv> p 4 1"
abbreviation p11 where "p11 \<equiv> p 1 1"
abbreviation p13 where "p13 \<equiv> p 1 3"
abbreviation p22 where "p22 \<equiv> p 2 2"
definition q :: "nat \<Rightarrow> nat \<Rightarrow> nat \<Rightarrow> kzp skat" where
"q i j k \<equiv> i := g (Var j) (Var k)"
abbreviation q214 where "q214 \<equiv> q 2 1 4"
abbreviation q311 where "q311 \<equiv> q 3 1 1"
abbreviation q211 where "q211 \<equiv> q 2 1 1"
abbreviation q222 where "q222 \<equiv> q 2 2 2"
declare q_def [skat_simp]
definition r :: "nat \<Rightarrow> nat \<Rightarrow> kzp skat" where
"r i j \<equiv> i := f (f (Var j))"
abbreviation r13 where "r13 \<equiv> r 1 3"
abbreviation r12 where "r12 \<equiv> r 1 2"
abbreviation r22 where "r22 \<equiv> r 2 2"
declare r_def [skat_simp]
lemma p_to_r: "p n n \<cdot>p n n = r n n"
by skat_simp (simp add: skat_assign3)
abbreviation x1 where "x1 \<equiv> 1 := vx"
definition s :: "nat \<Rightarrow> kzp skat" where
"s i \<equiv> i := f vx"
abbreviation s1 where "s1 \<equiv> s 1"
abbreviation s2 where "s2 \<equiv> s 2"
declare s_def [skat_simp]
definition t :: "nat \<Rightarrow> kzp skat" where
"t i \<equiv> i := g (f vx) (f vx)"
abbreviation t2 where "t2 \<equiv> t 2"
declare t_def [skat_simp]
definition u :: "nat \<Rightarrow> nat \<Rightarrow> nat \<Rightarrow> kzp skat" where
"u i j k \<equiv> i := g (f (f (Var j))) (f (f (Var k)))"
abbreviation "u222" where "u222 \<equiv> u 2 2 2"
declare u_def [skat_simp]
definition z :: "nat \<Rightarrow> kzp skat" where
"z i \<equiv> 0 := Var i"
declare z_def [skat_simp]
abbreviation z2 where "z2 \<equiv> z 2"
definition y :: "nat \<Rightarrow> kzp skat" where
"y i \<equiv> i := null"
declare y_def [skat_simp]
definition d :: "kzp skat" where
"d \<equiv> P (f vx)"
declare d_def [skat_simp]
no_notation
one_class.one ("1") and
dioid.one ("1\<index>") and
dioid.zero ("0\<index>") and
zero_class.zero ("0") and
plus_class.plus (infixl "+" 65)
abbreviation halt where "halt \<equiv> SKAT.halt [1,2,3,4]"
definition scheme1 where "scheme1 \<equiv>
[ 1 := vx, 4 := f (Var 1), 1 := f (Var 1)
, 2 := g (Var 1) (Var 4), 3 := g (Var 1) (Var 1)
, loop
[ !(P (Var 1)), 1 := f (Var 1)
, 2 := g (Var 1) (Var 4), 3 := g (Var 1) (Var 1)
]
, P (Var 1), 1 := f (Var 3)
, loop
[ !(P (Var 4)) + seq
[ P (Var 4)
, (!(P (Var 2)); 2 := f (Var 2))\<^sup>\<star>
, P (Var 2), ! (P (Var 3))
, 4 := f (Var 1), 1 := f (Var 1)
]
, 2 := g (Var 1) (Var 4), 3 := g (Var 1) (Var 1)
, loop
[ !(P (Var 1)), 1 := f (Var 1)
, 2 := g (Var 1) (Var 4), 3 := g (Var 1) (Var 1)
]
, P (Var 1), 1 := f (Var 3)
]
, P (Var 4)
, (!(P (Var 2)) \<cdot> 2 := f (Var 2))\<^sup>\<star>
, P (Var 2), P (Var 3), 0 := Var 2, halt
]"
definition scheme2 where "scheme2 \<equiv>
[ 2 := f vx, P (Var 2)
, 2 := g (Var 2) (Var 2)
, loop
[ !(P (Var 2))
, 2 := f (f (Var 2))
, P (Var 2)
, 2 := g (Var 2) (Var 2)
]
, P (Var 2), 0 := Var 2, halt
]"
declare Nat.One_nat_def [simp del]
declare foldr.simps[skat_simp]
declare o_def[skat_simp]
declare id_def[skat_simp]
declare halt.simps(1) [simp del]
lemma seq_merge: "seq (Vx#Vy#Vxs) = seq (Vx\<cdot>Vy#Vxs)"
by (metis seq_cons skd.mult_assoc)
lemma kozen1: "p41\<cdot>p11 = p41\<cdot>p11\<cdot>(a1 iff a4)"
by (subst bicon_comm) (auto simp add: pred_closed p_def a_def P_def f_def intro: eq_pred)
lemma kozen1_seq: "seq [p41,p11] = seq [p41,p11,(a1 iff a4)]"
by (metis kozen1 seq_merge)
lemma kozen2: "p41\<cdot>p11\<cdot>q214 = p41\<cdot>p11\<cdot>q211"
proof -
have "p41\<cdot>p11\<cdot>q214 = 4 := f (Var 1); 1 := f (Var 1); 2 := g (Var 1) (Var 4)"
by (simp add: p_def q_def)
also have "... = 1 := f (Var 1); 4 := Var 1; 2 := g (Var 1) (Var 4)"
by (subst skat_assign1_var[symmetric]) (auto simp add: f_def)
also have "... = 1 := f (Var 1); 4 := Var 1; 2 := g (Var 1) (Var 1)"
by (simp add: g_def f_def skd.mult_assoc, subst skat_assign2_var, auto)
also have "... = 4 := f (Var 1); 1 := f (Var 1); 2 := g (Var 1) (Var 1)"
by (subst skat_assign1_var) (auto simp add: f_def)
also have "... = p41\<cdot>p11\<cdot>q211"
by (simp add: p_def q_def)
finally show ?thesis .
qed
lemma kozen3: "p41\<cdot>p11\<cdot>q211\<cdot>q311\<cdot>a1\<cdot>a4 = p41\<cdot>p11\<cdot>q211\<cdot>q311\<cdot>a1"
proof -
have "p41\<cdot>p11\<cdot>q211\<cdot>q311\<cdot>a1 = p41\<cdot>p11\<cdot>(a1 iff a4)\<cdot>q211\<cdot>q311\<cdot>a1"
by (metis kozen1)
also have "... = p41\<cdot>p11\<cdot>q211\<cdot>q311\<cdot>(a1 iff a4)\<cdot>a1"
apply (subgoal_tac "(a1 iff a4)\<cdot>q211 = q211\<cdot>(a1 iff a4)" "(a1 iff a4)\<cdot>q311 = q311\<cdot>(a1 iff a4)")
apply (smt skd.mult_assoc)
by (skat_comm, auto)+
also have "... = p41\<cdot>p11\<cdot>q211\<cdot>q311\<cdot>a1\<cdot>a4"
apply (subgoal_tac "a1 iff a4 ; a1 = a1\<cdot>a4")
apply (smt skd.mult_assoc)
apply (subst bicon_comm)
apply auto
apply (subst bicon_conj1)
apply auto
by (rule a_comm)
finally show ?thesis ..
qed
lemma kozen3_seq: "seq [p41,p11,q211,q311,a1,a4] = seq [p41,p11,q211,q311,a1]"
by (simp add: seq_def skd.mult_onel kozen3)
lemma kozen4_seq: "seq [q211,q311,r13] = seq [q211,q311,r12]"
proof -
have "q211\<cdot>q311\<cdot>r13 = 2 := g (Var 1) (Var 1); 3 := g (Var 1) (Var 1); 1 := f (f (Var 3))"
by (simp add: q_def r_def)
also have "... = 2 := g (Var 1) (Var 1); 3 := Var 2; 1 := f (f (Var 3))"
by (subst skat_assign2_var[symmetric]) (auto simp add: g_def)
also have "... = 2 := g (Var 1) (Var 1); 3 := Var 2; 1 := f (f (Var 2))"
by (simp add: f_def g_def skd.mult_assoc, subst skat_assign2_var, auto)
also have "... = 2 := g (Var 1) (Var 1); 3 := g (Var 1) (Var 1); 1 := f (f (Var 2))"
by (subst skat_assign2_var) (auto simp add: g_def)
finally show ?thesis
by (simp add: q_def r_def seq_def skd.mult_onel)
qed
lemma kozen5': "q211\<cdot>q311 = q211\<cdot>q311\<cdot>(a2 iff a3)"
by (auto simp add: pred_closed q_def a_def P_def g_def intro: eq_pred)
lemma kozen5_seq1: "seq [q211,q311,a3] = seq [q211,q311,a2]"
proof -
have "q211\<cdot>q311\<cdot>a3 = q211\<cdot>q311\<cdot>(a2 iff a3)\<cdot>a3"
by (metis kozen5')
also have "... = q211\<cdot>q311\<cdot>a2\<cdot>a3"
by (subgoal_tac "(a2 iff a3)\<cdot>a3 = a2\<cdot>a3") (auto simp add: skd.mult_assoc intro: bicon_conj1)
also have "... = q211\<cdot>q311\<cdot>a3\<cdot>a2"
by (metis skd.mult_assoc a_comm)
also have "... = q211\<cdot>q311\<cdot>(a3 iff a2)\<cdot>a2"
by (subgoal_tac "(a3 iff a2)\<cdot>a2 = a3\<cdot>a2") (auto simp add: skd.mult_assoc intro: bicon_conj1)
also have "... = q211\<cdot>q311\<cdot>(a2 iff a3)\<cdot>a2"
by (subst bicon_comm, auto)
also have "... = q211\<cdot>q311\<cdot>a2"
by (smt kozen5')
finally show ?thesis
by (simp add: seq_def skd.mult_onel)
qed
lemma kozen5_seq2: "seq [q211,q311,!a3] = seq [q211,q311,!a2]"
proof -
have "q211\<cdot>q311\<cdot>!a3 = q211\<cdot>q311\<cdot>(!a2 iff !a3)\<cdot>!a3"
by (subst kozen5', subst bicon_not, auto)
also have "... = q211\<cdot>q311\<cdot>!a2\<cdot>!a3"
by (subgoal_tac "(!a2 iff !a3)\<cdot>!a3 = !a2\<cdot>!a3") (auto simp add: skd.mult_assoc intro: bicon_conj1 not_closed)
also have "... = q211\<cdot>q311\<cdot>!a3\<cdot>!a2"
by (subgoal_tac "!a3\<cdot>!a2 = !a2\<cdot>!a3", smt skd.mult_assoc, skat_comm)
also have "... = q211\<cdot>q311\<cdot>(!a3 iff !a2)\<cdot>!a2"
by (subgoal_tac "(!a3 iff !a2)\<cdot>!a2 = !a3\<cdot>!a2") (auto simp add: skd.mult_assoc intro: bicon_conj1 not_closed)
also have "... = q211\<cdot>q311\<cdot>(!a2 iff !a3)\<cdot>!a2"
by (subst bicon_comm) (auto intro: not_closed)
also have "... = q211\<cdot>q311\<cdot>!a2"
by (subst bicon_not[symmetric], auto, smt kozen5')
finally show ?thesis
by (simp add: seq_def skd.mult_onel)
qed
lemma plus_indiv: "\<lbrakk>vx1 = x2; y1 = y2\<rbrakk> \<Longrightarrow> (vx1::kzp skat) + y1 = x2 + y2"
by auto
lemma lemma41: "r12\<cdot>a1\<cdot>p22\<cdot>!a2\<cdot>p22\<cdot>!a2 = \<zero>"
proof -
have "r12\<cdot>a1\<cdot>p22\<cdot>!a2\<cdot>p22\<cdot>!a2 \<sqsubseteq> r12\<cdot>a1\<cdot>p22\<cdot>(a2 + !a2)\<cdot>p22\<cdot>!a2"
by (smt skat_order_def skd.add_assoc skd.add_comm skd.add_idem skd.distl skd.distr)
also have "... = r12\<cdot>a1\<cdot>p22\<cdot>p22\<cdot>!a2"
by (subst complement_one) (auto simp add: mult_oner)
also have "... = r12\<cdot>a1\<cdot>r22\<cdot>!a2"
by (metis p_to_r skd.mult_assoc)
also have "... = r12\<cdot>r22\<cdot>a1\<cdot>!a2"
by (subgoal_tac "a1\<cdot>r22 = r22\<cdot>a1", metis skd.mult_assoc, skat_comm)
also have "... = r12\<cdot>r22\<cdot>(a1 iff a2)\<cdot>a1\<cdot>!a2"
by (subgoal_tac "r12\<cdot>r22 = r12\<cdot>r22\<cdot>(a1 iff a2)") (auto simp add: r_def a_def P_def f_def intro: eq_pred)
also have "... = \<zero>"
apply (subgoal_tac "a1 iff a2; a1; !a2 = \<zero>")
apply (metis skd.mult_assoc skd.mult_zeror)
apply (subst bicon_comm)
apply auto
apply (subst bicon_conj1)
apply auto
apply (subgoal_tac "a2\<cdot>!a2 = \<zero>")
apply (metis a_comm skd.mult_assoc skd.mult_zeror)
apply (subst complement_zero)
by auto
finally show ?thesis
by (metis skd.nat_antisym skd.zero_min)
qed
theorem kozen_scheme_equivalence: "seq scheme1 = seq scheme2"
proof -
have "seq scheme1 = seq
[x1,p41,p11,q214,q311,loop [!a1,p11,q214,q311],a1,p13
,loop [!a4 + seq [a4,(!a2\<cdot>p22)\<^sup>\<star>,a2,!a3,p41,p11],q214,q311,loop [!a1,p11,q214,q311],a1,p13]
,a4,(!a2\<cdot>p22)\<^sup>\<star>,a2,a3,z2,halt]"
by (simp add: scheme1_def p_def[symmetric] q_def[symmetric] a_def[symmetric] z_def[symmetric])
also have "... = seq
[x1,p41,p11,q214,q311,loop [!a1,p11,q214,q311]
,loop [a1,p13,!a4 + seq [a4,(!a2\<cdot>p22)\<^sup>\<star>,a2,!a3,p41,p11],q214,q311,loop [!a1,p11,q214,q311]]
,a1,p13,a4,(!a2\<cdot>p22)\<^sup>\<star>,a2,a3,z2,halt]"
by (cong, cut 1 2, cut 6 1, simp, cut 2 4, cut 3 2, simp only: ska.star_slide[simplified])
also have "... = seq
[x1,p41,p11,q214,q311
,(seq [!a1,p11,q214,q311] + seq [a1,p13,!a4 + seq [a4,(!a2\<cdot>p22)\<^sup>\<star>,a2,!a3,p41,p11],q214,q311])\<^sup>\<star>
,a1,p13,a4,(!a2\<cdot>p22)\<^sup>\<star>,a2,a3,z2,halt]"
by (cong, cut 1 1, cut 2 5, simp add: ska.star_denest[symmetric,simplified])
also have "... = seq
[x1,p41,p11,q214,q311
,(seq [!a1,p11,q214,q311] + seq [a1,p13,!a4,q214,q311] + seq [a1,p13,a4,(!a2\<cdot>p22)\<^sup>\<star>,a2,!a3,p41,p11,q214,q311])\<^sup>\<star>
,a1,p13,a4,(!a2\<cdot>p22)\<^sup>\<star>,a2,a3,z2,halt]"
apply (cong, simp, subst skd.add_assoc[simplified])
apply (rule_tac f = "\<lambda>x. (?v + x)\<^sup>\<star>" in arg_cong)
apply (simp add: seq_foldr skd.mult_oner)
by (smt skd.distl skd.distr skd.mult_assoc)
also have "... = seq
[x1,p41,p11,q214,q311
,(seq [!a1,!a4,p11,q214,q311] + seq [!a1,a4,p11,q214,q311] + seq [a1,!a4,p13,q214,q311]
+ seq [a1,a4,p13,(!a2\<cdot>p22)\<^sup>\<star>,a2,!a3,p41,p11,q214,q311])\<^sup>\<star>
,(!a2\<cdot>p22)\<^sup>\<star>,a1,a2,a3,a4,z2,halt]"
apply congl
apply (rule seq_head_eq)
apply (rule arg_cong) back
apply (rule plus_indiv)+
apply (auto simp add: seq_head_elim_var[OF a_test])
apply cong
apply skat_comm
apply cong
apply skat_comm
apply (commr1 1 2)
apply (comml1 1 3)
apply congl
apply (comml1 2 3)
apply congl
apply (auto simp add: seq_foldr mult_oner p_def output_vars_kzp_def)
by (metis (lifting) halt_first skat_null_zero skd.mult_assoc)
also have "... = seq
[x1,p41,p11,q214,q311
,(seq [!a1,a4,p11,q214,q311]
+ seq [a1,a4,p13,(!a2\<cdot>p22)\<^sup>\<star>,a2,!a3,p41,p11,q214,q311])\<^sup>\<star>
,(!a2\<cdot>p22)\<^sup>\<star>,a1,a2,a3,a4,z2,halt]"
apply congl
apply (cut 1 1, simp, cut 6 1, simp)
apply (subst skd.add_assoc[simplified])
apply (subst skd.add_comm[simplified]) back
apply (subst skd.add_assoc[symmetric,simplified])
apply (subst skd.add_assoc[simplified]) back
apply (rule ska.kozen_skat_lemma[simplified])
apply (subgoal_tac "seq [!a1,!a4,p11,q214,q311] = seq [!a1,p11,q214,q311,!a4]")
apply (erule ssubst)
apply (subgoal_tac "seq [a1,!a4,p13,q214,q311] = seq [a1,p13,q214,q311,!a4]")
apply (erule ssubst)
apply (commr1 3 1)
apply (commr1 4 1)
apply (simp add: skd.distr[simplified] skd.distl[simplified])
apply (zero, auto simp add: skd.add_zerol)+
prefer 3
apply (subgoal_tac "seq [(!a2\<cdot>p22)\<^sup>\<star>,a1,a2,a3,a4,z2,halt] = seq [a4,(!a2\<cdot>p22)\<^sup>\<star>,a1,a2,a3,z2,halt]")
apply (erule ssubst)
apply (subgoal_tac "seq [!a1,!a4,p11,q214,q311] = seq [!a1,p11,q214,q311,!a4]")
apply (erule ssubst)
apply (subgoal_tac "seq [a1,!a4,p13,q214,q311] = seq [a1,p13,q214,q311,!a4]")
apply (erule ssubst)
apply (simp add: skd.distr[simplified])
apply (comml1 2 5)
apply (comml1 4 5)
apply (zero, auto simp add: skd.add_zerol)+
apply seq_comm
apply seq_comm
apply (comml1 2 2, cong)
by seq_comm
also have "... = seq
[x1,p41,p11,q214,q311
,(seq [a1,a4,p13,(!a2\<cdot>p22)\<^sup>\<star>,a2,!a3,p41,p11,q214,q311])\<^sup>\<star>
,(!a2\<cdot>p22)\<^sup>\<star>,a1,a2,a3,a4,z2,halt]"
apply congr
apply (subst seq_foldr)
apply (subst seq_foldr) back back
apply (simp add: skd.mult_assoc[symmetric,simplified] skd.mult_oner[simplified])
apply (rule ska.kozen_skat_lemma_dual[simplified])
apply (cut 1 6, cut 2 2, seq_select 2, subst kozen1_seq, seq_deselect)
apply (subst seq_mult[symmetric], subst seq_mult[symmetric], simp)
apply (subst zippify, simp)
apply (subst zip_right)
apply (subst zip_right)
apply (comml1 1 4)
apply (comml1 1 4)
apply (subst seq_merge)
apply (rule zip_zero)
apply (metis (lifting) a_test bicon_zero)
apply (subst skd.mult_assoc[simplified])
apply (subst kozen1)
apply (simp add: skd.mult_assoc[symmetric,simplified])
apply (subst seq_singleton[symmetric])
apply seq_rev
apply (subst qes_snoc[symmetric])+
apply (subst qes_snoc)
apply (subst zip_right, subst zip_right)
apply (comml1 1 4)
apply (comml1 1 4)
apply (subst seq_merge, rule zip_zero)
by (metis (lifting) a_test bicon_zero)
also have "... = seq
[x1,p41,p11,q211,q311
,(seq [a1,a4,p13,(!a2\<cdot>p22)\<^sup>\<star>,a2,!a3,p41,p11,q211,q311])\<^sup>\<star>
,(!a2\<cdot>p22)\<^sup>\<star>,a1,a2,a3,a4,z2,halt]"
by (simp add: seq_def skd.mult_onel[simplified], smt kozen2 skd.mult_assoc)
also have "... = seq
[x1,(seq [p41,p11,q211,q311,a1,a4,p13,(!a2\<cdot>p22)\<^sup>\<star>,a2,!a3])\<^sup>\<star>
,p41,p11,q211,q311,(!a2\<cdot>p22)\<^sup>\<star>,a1,a2,a3,a4,z2,halt]"
by (cong, cut 1 4, cut 3 6, cut 6 4, cut 5 1, simp add: ska.star_slide)
also have "... = seq
[x1,(seq [p41,p11,q211,q311,a1,p13,(!a2\<cdot>p22)\<^sup>\<star>,a2,!a3])\<^sup>\<star>
,p41,p11,q211,q311,a1,(!a2\<cdot>p22)\<^sup>\<star>,a2,a3,z2,halt]"
apply (cut 2 6, zip 1 7, subst zip_comm, skat_comm)
apply (zip 3 3)
apply (subst zip_comm, skat_comm, subst zip_right)+
apply (unzip+, cut 1 2, cut 4 6)
apply (simp add: kozen3_seq)
by (subst seq_mult[symmetric], simp)+
also have "... = seq
[x1,(seq [p41,p11,q211,q311,a1,p13,(!a2\<cdot>p22)\<^sup>\<star>,a2,!a3])\<^sup>\<star>
,p41,p11,q211,q311,(!a2\<cdot>p22)\<^sup>\<star>,a1,a2,a3,z2,halt]"
by (congr, zip 3 7, subst zip_comm, skat_comm, unzip, seq_deselect)
also have "... = seq
[x1,(seq [p11,q211,q311,a1,p13,(!a2\<cdot>p22)\<^sup>\<star>,a2,!a3])\<^sup>\<star>
,p11,q211,q311,(!a2\<cdot>p22)\<^sup>\<star>,a1,a2,a3,z2,halt]"
by (eliminate_variable 4)
also have "... = seq
[x1,p11,(seq [q211,q311,(!a2\<cdot>p22)\<^sup>\<star>,a1,a2,!a3,p13,p11])\<^sup>\<star>
,q211,q311,(!a2\<cdot>p22)\<^sup>\<star>,a1,a2,a3,z2,halt]"
by (commr1 2 5, commr1 2 4 1, simp add: seq_def mult_onel, smt ska.star_slide skd.mult_assoc)
also have "... = seq
[s1,(seq [q211,q311,(!a2\<cdot>p22)\<^sup>\<star>,a1,a2,!a3,r13])\<^sup>\<star>
,q211,q311,(!a2\<cdot>p22)\<^sup>\<star>,a1,a2,a3,z2,halt]"
proof -
have "x1\<cdot>p11 = s1"
by (simp add: vx_def f_def p_def s_def, subst skat_assign3, auto)
moreover have "p13\<cdot>p11 = r13"
by (simp add: f_def p_def r_def, subst skat_assign3, auto)
ultimately show ?thesis
by (simp add: seq_def skd.mult_onel) (smt skd.mult_assoc)
qed
also have "... = seq
[s1,(seq [a1,q211,q311,r13,(!a2\<cdot>p22)\<^sup>\<star>,a2,!a3])\<^sup>\<star>
,q211,q311,(!a2\<cdot>p22)\<^sup>\<star>,a1,a2,a3,z2,halt]"
by (comml1 2 4, comml1 2 7)
also have "... = seq
[s1,(seq [a1,q211,q311,!a2,r12,(!a2\<cdot>p22)\<^sup>\<star>,a2])\<^sup>\<star>
,q211,q311,a2,(!a2\<cdot>p22)\<^sup>\<star>,a1,a2,z2,halt]"
apply (cut 2 1)
apply (cut 3 3)
apply (simp only: kozen4_seq seq_mult[symmetric] append.simps)
apply (comml1 2 7, comml1 1 8, cut 1 2, cut 3 3, cut 2 1, cut 3 3)
apply (simp add: kozen5_seq1 kozen5_seq2)
by (simp add: seq_def mult_onel skd.mult_assoc[simplified])
also have "... = seq
[s1,(seq [a1,q211,!a2,r12,(!a2\<cdot>p22)\<^sup>\<star>,a2])\<^sup>\<star>
,q211,a2,(!a2\<cdot>p22)\<^sup>\<star>,a1,a2,z2,halt]"
by (eliminate_variable 3)
also have "... = seq
[s1,(seq [a1,q211,r12,!a2,p22,(!a2\<cdot>p22)\<^sup>\<star>,a2])\<^sup>\<star>
,q211,a1,a2,z2,halt]"
proof -
have "!a2\<cdot>(!a2\<cdot>p22)\<^sup>\<star>\<cdot>a2 = !a2\<cdot>a2 + !a2\<cdot>!a2\<cdot>p22\<cdot>(!a2\<cdot>p22)\<^sup>\<star>\<cdot>a2"
by (smt mult_oner ska.star_unfoldl_eq skd.distl skd.distr skd.mult_assoc)
also have "... = !a2\<cdot>p22\<cdot>(!a2\<cdot>p22)\<^sup>\<star>\<cdot>a2"
by (smt skd.add_zerol a_test not_closed skt.test_meet_idem complement_zero not_closed skt.test_mult_comm)
finally have a: "!a2\<cdot>(!a2\<cdot>p22)\<^sup>\<star>\<cdot>a2 = !a2\<cdot>p22\<cdot>(!a2\<cdot>p22)\<^sup>\<star>\<cdot>a2" .
have "a2\<cdot>(!a2\<cdot>p22)\<^sup>\<star>\<cdot>a2 = a2\<cdot>a2 + a2\<cdot>!a2\<cdot>p22\<cdot>(!a2\<cdot>p22)\<^sup>\<star>\<cdot>a2"
by (smt mult_oner ska.star_unfoldl_eq skd.distl skd.distr skd.mult_assoc)
also have "... = a2"
by (metis skd.add_zeror skd.mult_zerol a_test complement_zero skt.test_meet_idem)
finally have b: "a2\<cdot>(!a2\<cdot>p22)\<^sup>\<star>\<cdot>a2 = a2" .
from a b show ?thesis
by (comml1 2 4 1, simp add: seq_def mult_onel, smt a_comm skd.mult_assoc)
qed
also have "... = seq
[s1,a1,q211,(seq [r12,!a2,p22,(!a2\<cdot>p22)\<^sup>\<star>,a2,a1,q211])\<^sup>\<star>,a2,z2,halt]"
apply (comml1 1 4 1)
apply (cut 1 1)
apply (cut 2 3)
apply (cut 3 2)
apply (cut 2 1)
apply (simp add: seq_singleton)
apply (subst ska.star_slide[simplified])
by (simp add: seq_def mult_onel skd.mult_assoc)
also have "... = seq
[s1,a1,q211,(seq [!a2,r12,p22,(!a2\<cdot>p22)\<^sup>\<star>,a2,a1,q211])\<^sup>\<star>,a2,z2,halt]"
by (comml1 2 2)
also have "... = seq
[s1,a1,q211,(seq [!a2,r12,a1,p22,a2,q211] + seq [!a2,r12,a1,p22,!a2,p22,a2,q211])\<^sup>\<star>
,a2,z2, halt]"
proof -
have "r12\<cdot>a1\<cdot>p22\<cdot>(!a2\<cdot>p22)\<^sup>\<star> = r12\<cdot>a1\<cdot>p22\<cdot>(\<one> + !a2\<cdot>p22 + !a2\<cdot>p22\<cdot>!a2\<cdot>p22\<cdot>(!a2\<cdot>p22)\<^sup>\<star>)"
apply (subst ska.star_unfoldl_eq[simplified])
apply (subst ska.star_unfoldl_eq[simplified])
by (smt skd.add_assoc skd.distl skd.mult_assoc skd.mult_oner)
also have "... = r12\<cdot>a1\<cdot>p22 + r12\<cdot>a1\<cdot>p22\<cdot>!a2\<cdot>p22 + r12\<cdot>a1\<cdot>p22\<cdot>!a2\<cdot>p22\<cdot>!a2\<cdot>p22\<cdot>(!a2\<cdot>p22)\<^sup>\<star>"
by (smt skd.mult_oner skd.distl skd.mult_assoc)
also have "... = r12\<cdot>a1\<cdot>p22 + r12\<cdot>a1\<cdot>p22\<cdot>!a2\<cdot>p22"
by (smt lemma41 skd.add_zeror skd.mult_zerol)
finally have "r12\<cdot>a1\<cdot>p22\<cdot>(!a2\<cdot>p22)\<^sup>\<star> = r12\<cdot>a1\<cdot>p22 + r12\<cdot>a1\<cdot>p22\<cdot>!a2\<cdot>p22" .
thus ?thesis
apply (cong, simp)
apply (comml1 1 6)
apply (simp add: seq_def skd.mult_onel)
by (smt skd.distl skd.distr skd.mult_assoc)
qed
also have "... = seq
[s1,a1,q211,(seq [!a2,r12,a1,p22,a2,q211] + seq [!a2,r12,a1,p22,!a2,p22,q211])\<^sup>\<star>
,a2,z2, halt]"
proof -
have "r12\<cdot>a1\<cdot>p22\<cdot>!a2\<cdot>p22 = r12\<cdot>a1\<cdot>p22\<cdot>!a2\<cdot>p22\<cdot>\<one>"
by (metis skd.mult_oner)
also have "... = r12\<cdot>a1\<cdot>p22\<cdot>!a2\<cdot>p22\<cdot>(a2 + !a2)"
by (subst complement_one) auto
also have "... = r12\<cdot>a1\<cdot>p22\<cdot>!a2\<cdot>p22\<cdot>a2 + r12\<cdot>a1\<cdot>p22\<cdot>!a2\<cdot>p22\<cdot>!a2"
by (metis skd.distl)
also have "... = r12\<cdot>a1\<cdot>p22\<cdot>!a2\<cdot>p22\<cdot>a2"
by (smt lemma41 skd.add_zeror)
finally have "r12\<cdot>a1\<cdot>p22\<cdot>!a2\<cdot>p22 = r12\<cdot>a1\<cdot>p22\<cdot>!a2\<cdot>p22\<cdot>a2" .
thus ?thesis
apply cong
apply (rule arg_cong) back back back back
apply (simp add: seq_def skd.mult_onel)
by (smt skd.mult_assoc)
qed
also have "... = seq
[s1,a1,q211,(seq [!a2,r12,a1,p22,a2,q211] + seq [!a2,r12,a1,p22,!a2,q211])\<^sup>\<star>
,a2,z2, halt]"
proof -
have "p22\<cdot>q211 = q211"
by (simp add: p_def q_def g_def f_def skat_assign3)
thus ?thesis
by (simp add: seq_def skd.mult_onel) (smt skd.mult_assoc)
qed
also have "... = seq [s1,a1,q211,(seq [!a2,r12,a1,p22,(a2 + !a2),q211])\<^sup>\<star>,a2,z2, halt]"
apply cong
apply (rule arg_cong) back back back
by (smt seq_cons skd.distl skd.distr)
also have "... = seq [s1,a1,q211,(seq [!a2,r12,a1,p22,q211])\<^sup>\<star>,a2,z2, halt]"
by (subst complement_one, auto simp add: seq_def skd.mult_onel skd.mult_oner)
also have "... = seq [s1,a1,q211,(seq [!a2,r12,a1,q211])\<^sup>\<star>,a2,z2, halt]"
proof -
have "p22\<cdot>q211 = q211"
by (simp add: p_def q_def g_def f_def skat_assign3)
thus ?thesis
by (simp add: seq_def skd.mult_onel) (smt skd.mult_assoc)
qed
also have "... = seq [d,s1,t2,(seq [!a2,c2,r12,u222])\<^sup>\<star>,a2,z2,halt]"
proof -
{
have "s1\<cdot>a1\<cdot>q211 = d\<cdot>s1\<cdot>q211"
by (simp add: s_def a_def f_def P_def d_def skat_assign4_var[symmetric])
also have "... = d\<cdot>s1\<cdot>t2"
apply (simp add: t_def s_def d_def f_def P_def q_def g_def vx_def skd.mult_assoc)
apply (rule arg_cong) back
apply (rule skat_assign2_var)
by auto
finally have "s1\<cdot>a1\<cdot>q211 = d\<cdot>s1\<cdot>t2" .
}
moreover
{
have "r12\<cdot>a1\<cdot>q211 = c2\<cdot>r12\<cdot>q211"
by (simp add: r_def a_def f_def P_def c_def skat_assign4_var[symmetric])
also have "... = c2\<cdot>r12\<cdot>u222"
apply (simp add: c_def r_def u_def f_def P_def q_def g_def vx_def skd.mult_assoc)
apply (rule arg_cong) back
apply (rule skat_assign2_var)
by auto
finally have "r12\<cdot>a1\<cdot>q211 = c2\<cdot>r12\<cdot>u222" .
}
ultimately show ?thesis
by (simp add: seq_def skd.mult_onel) (smt skd.mult_assoc)
qed
also have "... = seq [d,t2,(seq [!a2,c2,u222])\<^sup>\<star>,a2,z2,halt]"
by (eliminate_variable 1)
also have "... = seq [s2,a2,q222,(seq [!a2,r22,a2,q222])\<^sup>\<star>,a2,z2,halt]"
proof -
{
have "d\<cdot>t2 = d\<cdot>s2\<cdot>q222"
by (simp add: g_def d_def t_def s_def q_def skd.mult_assoc, subst skat_assign3, auto)
also have "... = s2\<cdot>a2\<cdot>q222"
by (simp add: d_def s_def a_def f_def P_def skat_assign4_var[symmetric])
finally have "d\<cdot>t2 = s2\<cdot>a2\<cdot>q222" .
}
moreover
{
have "c2\<cdot>u222 = c2\<cdot>r22\<cdot>q222"
by (simp add: g_def c_def u_def r_def q_def skd.mult_assoc, subst skat_assign3, auto)
also have "... = r22\<cdot>a2\<cdot>q222"
by (simp add: f_def P_def a_def r_def c_def skat_assign4_var[symmetric])
finally have "c2\<cdot>u222 = r22\<cdot>a2\<cdot>q222" .
}
ultimately show "?thesis"
by (simp add: seq_def skd.mult_onel) (smt skd.mult_assoc)
qed
also have "... = seq scheme2"
by (simp add: scheme2_def) skat_simp
finally show ?thesis .
qed
end
|
Formal statement is: lemma starlike_convex_tweak_boundary_points: fixes S :: "'a::euclidean_space set" assumes "convex S" "S \<noteq> {}" and ST: "rel_interior S \<subseteq> T" and TS: "T \<subseteq> closure S" shows "starlike T" Informal statement is: If $S$ is a nonempty convex set and $T$ is a set such that the relative interior of $S$ is a subset of $T$ and $T$ is a subset of the closure of $S$, then $T$ is starlike. |
The Little Rock Arsenal was classified in 1860 as an " arsenal of deposit , " meaning that it was simply a warehouse for the storage of weapons intended for the use of the state militia in times of crisis . Thus there were no substantial operations for ordnance fabrication or repairs , nor for the manufacture of cartridges at the time the Arsenal fell into State hands . Most of these operations were started from scratch through the efforts of the Arkansas Military Board .
|
{-# OPTIONS --cubical --no-import-sorts #-}
open import Bundles
module Properties.AlmostOrderedField {ℓ ℓ'} (AOF : AlmostOrderedField {ℓ} {ℓ'}) where
open import Agda.Primitive renaming (_⊔_ to ℓ-max; lsuc to ℓ-suc; lzero to ℓ-zero)
private
variable
ℓ'' : Level
open import Cubical.Foundations.Everything renaming (_⁻¹ to _⁻¹ᵖ; assoc to ∙-assoc)
open import Cubical.Relation.Nullary.Base -- ¬_
open import Cubical.Relation.Binary.Base
open import Cubical.Data.Sum.Base renaming (_⊎_ to infixr 4 _⊎_)
open import Cubical.Data.Sigma.Base renaming (_×_ to infixr 4 _×_)
open import Cubical.Data.Empty renaming (elim to ⊥-elim) -- `⊥` and `elim`
open import Function.Base using (_∋_)
open import Function.Base using (it) -- instance search
import MoreLogic
open MoreLogic.Reasoning
import MoreAlgebra
-- Lemma 4.1.11.
-- In the presence of the first five axioms of Definition 4.1.10, conditions (†) and (∗) are together equivalent to the condition that for all x, y, z : F,
-- 1. x ≤ y ⇔ ¬(y < x),
-- 2. x # y ⇔ (x < y) ∨ (y < x)
-- 3. x ≤ y ⇔ x + z ≤ y + z,
-- 4. x < y ⇔ x + z < y + z,
-- 5. 0 < x + y ⇒ 0 < x ∨ 0 < y,
-- 6. x < y ≤ z ⇒ x < z,
-- 7. x ≤ y < z ⇒ x < z,
-- 8. x ≤ y ∧ 0 ≤ z ⇒ x z ≤ y z,
-- 9. 0 < z ⇒ (x < y ⇔ x z < y z),
-- 10. 0 < 1.
open AlmostOrderedField AOF renaming (Carrier to F)
import Cubical.Structures.Ring
open Cubical.Structures.Ring.Theory (record {AlmostOrderedField AOF})
open MoreAlgebra.Properties.Group (record {AlmostOrderedField AOF renaming (+-isGroup to isGroup )})
-- NOTE: ported from Cubical.Structures.Group.GroupLemmas
-- NOTE: these versions differ from the Group-versions because they are defined w.r.t. an appartness relation _#_ that is not present for the Group
simplR : {a b : F} (c : F) {{_ : c # 0f}} → a · c ≡ b · c → a ≡ b
simplR {a} {b} c {{_}} a·c≡b·c =
a ≡⟨ sym (fst (·-identity a)) ∙ cong (a ·_) (sym (·-rinv c it)) ∙ ·-assoc _ _ _ ⟩
(a · c) · (c ⁻¹ᶠ) ≡⟨ cong (_· c ⁻¹ᶠ) a·c≡b·c ⟩
(b · c) · (c ⁻¹ᶠ) ≡⟨ sym (·-assoc _ _ _) ∙ cong (b ·_) (·-rinv c it) ∙ fst (·-identity b) ⟩
b ∎
·-preserves-≡ʳ : {a b : F} (c : F) {{_ : c # 0f}} → a · c ≡ b · c → a ≡ b
·-preserves-≡ʳ = simplR
-- ·-linv-unique : (x y : F) (x·y≡1 : (x ·₁ y) ≡ 1f) → x ≡ (y ⁻¹ᶠ₁)
module _ (x y : F) (x·y≡1 : x · y ≡ 1f) where
y#0 = snd (·-inv-back _ _ x·y≡1) -- duplicated inhabitant (see notes)
instance _ = y # 0f ∋ y#0
import Cubical.Structures.Group
-- NOTE: ported from Cubical.Structures.Group.GroupLemmas
abstract
·-linv-unique' : Σ[ p ∈ y # 0f ] (x ≡ _⁻¹ᶠ y {{p}})
·-linv-unique' = it , (
x · y ≡ 1f ⇒⟨ transport (λ i → x · y ≡ ·-linv y it (~ i)) ⟩
x · y ≡ y ⁻¹ᶠ · y ⇒⟨ simplR _ ⟩
x ≡ y ⁻¹ᶠ ◼) x·y≡1
·-linv-unique : (x y : F) → ((x · y) ≡ 1f) → Σ[ p ∈ y # 0f ] x ≡ (_⁻¹ᶠ y {{p}})
·-linv-unique = ·-linv-unique'
-- ⁻¹ᶠ-involutive : (x : F) (z#0 : x #' 0f) → ((x ⁻¹ᶠ₁) ⁻¹ᶠ₁) ≡ x
module _ (z : F) (z#0 : z # 0f) where
private
instance _ = z#0
z⁻¹ = z ⁻¹ᶠ -- NOTE: interestingly, the instance argument is not applied and y remains normalized in terms of z
-- so we get `y : {{ _ : z #' 0f }} → F` here
z⁻¹#0 = snd (·-inv-back z z⁻¹ (·-rinv z it))
-- NOTE: for some reason I get "There are instances whose type is still unsolved when checking that the expression it has type z #' 0f"
-- typing `y : F` did not help much. therefore this goes in two lines
instance _ = z⁻¹#0
z⁻¹⁻¹ = z⁻¹ ⁻¹ᶠ
-- NOTE: this should be similar to `right-helper` + `-involutive`
⁻¹ᶠ-involutive : (z ⁻¹ᶠ) ⁻¹ᶠ ≡ z
⁻¹ᶠ-involutive = (
z⁻¹⁻¹ ≡⟨ sym (fst (·-identity _)) ⟩
z⁻¹⁻¹ · 1f ≡⟨ (λ i → z⁻¹⁻¹ · ·-linv _ it (~ i)) ⟩
z⁻¹⁻¹ · (z⁻¹ · z) ≡⟨ ·-assoc _ _ _ ⟩
(z⁻¹⁻¹ · z⁻¹) · z ≡⟨ (λ i → ·-linv z⁻¹ it i · z) ⟩
1f · z ≡⟨ snd (·-identity _) ⟩
z ∎)
module forward -- 6. ⇒ 1. 2. 3. 4. 5.
-- 6. (†)
(+-<-extensional : ∀ w x y z → (x + y) < (z + w) → (x < z) ⊎ (y < w))
-- 6. (∗)
(·-preserves-< : ∀ x y z → 0f < z → x < y → (x · z) < (y · z))
where
-- abstract
-- 1. x ≤ y ⇔ ¬(y < x),
item-1 : ∀ x y → x ≤ y → ¬(y < x)
item-1 = λ _ _ x≤y → x≤y -- holds definitionally
item-1-back : ∀ x y → ¬(y < x) → x ≤ y
item-1-back = λ _ _ ¬[y<x] → ¬[y<x]
-- 2. x # y ⇔ (x < y) ∨ (y < x)
item-2 : ∀ x y → x # y → (x < y) ⊎ (y < x)
item-2 = λ _ _ x#y → x#y -- holds definitionally
item-2-back : ∀ x y → (x < y) ⊎ (y < x) → x # y
item-2-back = λ _ _ [x<y]⊎[y<x] → [x<y]⊎[y<x] -- holds definitionally
-- NOTE: just a plain copy of the previous proof
+-preserves-< : ∀ a b x → a < b → a + x < b + x
+-preserves-< a b x a<b = (
a < b ⇒⟨ transport (λ i → sym (fst (+-identity a)) i < sym (fst (+-identity b)) i) ⟩
a + 0f < b + 0f ⇒⟨ transport (λ i → a + sym (+-rinv x) i < b + sym (+-rinv x) i) ⟩
a + (x - x) < b + (x - x) ⇒⟨ transport (λ i → +-assoc a x (- x) i < +-assoc b x (- x) i) ⟩
(a + x) - x < (b + x) - x ⇒⟨ +-<-extensional (- x) (a + x) (- x) (b + x) ⟩
(a + x < b + x) ⊎ (- x < - x) ⇒⟨ (λ{ (inl a+x<b+x) → a+x<b+x -- somehow ⊥-elim needs a hint in the next line
; (inr -x<-x ) → ⊥-elim {A = λ _ → (a + x < b + x)} (<-irrefl (- x) -x<-x) }) ⟩
a + x < b + x ◼) a<b
+-preserves-<-back : ∀ x y z → x + z < y + z → x < y
+-preserves-<-back x y z =
( x + z < y + z ⇒⟨ +-preserves-< _ _ (- z) ⟩
(x + z) - z < (y + z) - z ⇒⟨ transport (λ i → +-assoc x z (- z) (~ i) < +-assoc y z (- z) (~ i)) ⟩
x + (z - z) < y + (z - z) ⇒⟨ transport (λ i → x + +-rinv z i < y + +-rinv z i) ⟩
x + 0f < y + 0f ⇒⟨ transport (λ i → fst (+-identity x) i < fst (+-identity y) i) ⟩
x < y ◼)
-- 3. x ≤ y ⇔ x + z ≤ y + z,
item-3 : ∀ x y z → x ≤ y → x + z ≤ y + z
item-3 x y z = (
x ≤ y ⇒⟨ (λ z → z) ⟩ -- unfold the definition
(y < x → ⊥) ⇒⟨ (λ f → f ∘ (+-preserves-<-back y x z) ) ⟩
(y + z < x + z → ⊥) ⇒⟨ (λ z → z) ⟩ -- refold the definition
x + z ≤ y + z ◼)
item-3-back : ∀ x y z → x + z ≤ y + z → x ≤ y
item-3-back x y z = (
x + z ≤ y + z ⇒⟨ (λ z → z) ⟩ -- unfold the definition
(y + z < x + z → ⊥) ⇒⟨ (λ f p → f (+-preserves-< y x z p)) ⟩ -- just a variant of the above
(y < x → ⊥) ⇒⟨ (λ z → z) ⟩ -- refold the definition
x ≤ y ◼)
-- 4. x < y ⇔ x + z < y + z,
item-4 : ∀ x y z → x < y → x + z < y + z
item-4 = +-preserves-<
item-4-back : ∀ x y z → x + z < y + z → x < y
item-4-back = +-preserves-<-back
-- 5. 0 < x + y ⇒ 0 < x ∨ 0 < y,
item-5 : ∀ x y → 0f < x + y → (0f < x) ⊎ (0f < y)
item-5 x y = (
(0f < x + y) ⇒⟨ transport (λ i → fst (+-identity 0f) (~ i) < x + y) ⟩
(0f + 0f < x + y) ⇒⟨ +-<-extensional y 0f 0f x ⟩
(0f < x) ⊎ (0f < y) ◼)
-- 6. x < y ≤ z ⇒ x < z,
item-6 : ∀ x y z → x < y → y ≤ z → x < z
item-6 x y z x<y y≤z = (
x < y ⇒⟨ +-preserves-< _ _ _ ⟩
x + z < y + z ⇒⟨ transport (λ i → x + z < +-comm y z i) ⟩
x + z < z + y ⇒⟨ +-<-extensional y x z z ⟩
(x < z) ⊎ (z < y) ⇒⟨ (λ{ (inl x<z) → x<z
; (inr z<y) → ⊥-elim (y≤z z<y) }) ⟩
x < z ◼) x<y
-- 7. x ≤ y < z ⇒ x < z,
item-7 : ∀ x y z → x ≤ y → y < z → x < z
item-7 x y z x≤y = ( -- very similar to the previous one
y < z ⇒⟨ +-preserves-< y z x ⟩
y + x < z + x ⇒⟨ transport (λ i → +-comm y x i < z + x) ⟩
x + y < z + x ⇒⟨ +-<-extensional x x y z ⟩
(x < z) ⊎ (y < x) ⇒⟨ (λ{ (inl x<z) → x<z
; (inr y<x) → ⊥-elim (x≤y y<x)}) ⟩
x < z ◼)
item-10 : 0f < 1f
module _ (z : F) (0<z : 0f < z) where
private
instance _ = z # 0f ∋ inr 0<z
z⁻¹ = z ⁻¹ᶠ
z⁻¹#0 = snd (·-inv-back z z⁻¹ (·-rinv z it))
abstract
⁻¹ᶠ-preserves-sign : 0f < z ⁻¹ᶠ
⁻¹ᶠ-preserves-sign with z⁻¹#0
... | inl z⁻¹<0 = (
z⁻¹ < 0f ⇒⟨ ·-preserves-< _ _ z 0<z ⟩
z⁻¹ · z < 0f · z ⇒⟨ transport (λ i → ·-linv z it i < 0-leftNullifies z i) ⟩
1f < 0f ⇒⟨ <-trans _ _ _ item-10 ⟩
0f < 0f ⇒⟨ <-irrefl _ ⟩
⊥ ⇒⟨ ⊥-elim ⟩ _ ◼) z⁻¹<0
... | inr 0<z⁻¹ = 0<z⁻¹
-- 8. x ≤ y ∧ 0 ≤ z ⇒ x z ≤ y z,
item-8 : ∀ x y z → x ≤ y → 0f ≤ z → x · z ≤ y · z
-- For item 8, suppose x ≤ y and 0 ≤ z and yz < xz.
item-8 x y z x≤y 0≤z y·z<x·z = let
-- Then 0 < z (x − y) by (†),
i = ( y · z < x · z ⇒⟨ transport (λ i → ·-comm y z i < ·-comm x z i) ⟩
z · y < z · x ⇒⟨ +-preserves-< _ _ _ ⟩
(z · y) - (z · y) < (z · x) - (z · y ) ⇒⟨ transport (cong₂ _<_ (+-rinv (z · y))
( λ i → (z · x) + sym (-commutesWithRight-· z y) i )) ⟩
0f < (z · x) + (z · (- y)) ⇒⟨ transport (cong₂ _<_ refl (sym (fst (dist z x (- y))))) ⟩ -- [XX]
0f < z · (x - y) ◼) y·z<x·z
instance _ = z · (x - y) # 0f ∋ inr i
-- and so, being apart from 0, z (x − y) has a multiplicative inverse w.
w = (z · (x - y)) ⁻¹ᶠ
ii : 1f ≡ (z · (x - y)) · w
ii = sym (·-rinv _ _)
-- Hence z itself has a multiplicative inverse w (x − y),
iii : 1f ≡ z · ((x - y) · w)
iii = transport (λ i → 1f ≡ ·-assoc z (x - y) w (~ i)) ii
instance z#0f = z # 0f ∋ fst (·-inv-back _ _ (sym iii))
-- and so 0 < z ∨ z < 0, where the latter case contradicts the assumption 0 ≤ z, so that we have 0 < z.
instance _ = 0f < z ∋ case z#0f of λ where
(inl z<0) → ⊥-elim (0≤z z<0)
(inr 0<z) → 0<z
-- Now w (x − y) has multiplicative inverse z, so it is apart from 0,
iv : (x - y) · w # 0f
iv = snd (·-inv-back _ _ (sym iii))
-- that is (0 < w (x − y)) ∨ (w (x − y) < 0).
in case iv of λ where
-- By (∗), from 0 < w (x − y) and yz < xz we get yzw (x − y) < xzw (x − y), so y < x, contradicting our assumption that x ≤ y.
(inr 0<[x-y]·w) → (
y · z < x · z ⇒⟨ ·-preserves-< _ _ _ 0<[x-y]·w ⟩
(y · z) · ((x - y) · w) < (x · z) · ((x - y) · w) ⇒⟨ transport (λ i →
(·-assoc y z ((x - y) · w)) (~ i)
< (·-assoc x z ((x - y) · w)) (~ i)) ⟩
y · (z · ((x - y) · w)) < x · (z · ((x - y) · w)) ⇒⟨ transport (λ i →
y · (iii (~ i)) < x · (iii (~ i))) ⟩
y · 1f < x · 1f ⇒⟨ transport (cong₂ _<_
(fst (·-identity y)) (fst (·-identity x))) ⟩
y < x ⇒⟨ x≤y ⟩
⊥ ◼) y·z<x·z
-- In the latter case, from (∗) we get zw (x − y) < 0, i.e.
-- 1 < 0 which contradicts item 10, so that we have 0 < w (x − y).
(inl p) → (
(x - y) · w < 0f ⇒⟨ ·-preserves-< _ _ _ it ⟩
((x - y) · w) · z < 0f · z ⇒⟨ transport (cong₂ _<_ (·-comm _ _) (0-leftNullifies z)) ⟩
z · ((x - y) · w) < 0f ⇒⟨ ( transport λ i → iii (~ i) < 0f) ⟩
1f < 0f ⇒⟨ <-trans _ _ _ item-10 ⟩
0f < 0f ⇒⟨ <-irrefl _ ⟩
⊥ ◼) p
-- 9. 0 < z ⇒ (x < y ⇔ x z < y z),
item-9 : ∀ x y z → 0f < z → (x < y → x · z < y · z)
item-9 = ·-preserves-<
item-9-back : ∀ x y z → 0f < z → (x · z < y · z → x < y)
-- For the other direction of item 9, assume 0 < z and xz < yz,
item-9-back x y z 0<z x·z<y·z = let
instance _ = ( x · z < y · z ⇒⟨ +-preserves-< _ _ _ ⟩
(x · z) - (x · z) < (y · z) - (x · z) ⇒⟨ transport (cong₂ _<_ (+-rinv (x · z)) refl) ⟩
0f < (y · z) - (x · z) ◼) x·z<y·z
_ = (y · z) - (x · z) # 0f ∋ inr it
-- so that yz − xz has a multiplicative inverse w,
w = ((y · z) - (x · z)) ⁻¹ᶠ
o = ( (y · z) - ( x · z) ≡⟨ ( λ i → (y · z) + (-commutesWithLeft-· x z) (~ i)) ⟩
(y · z) + ((- x) · z) ≡⟨ sym (snd (dist y (- x) z)) ⟩
(y - x) · z ∎)
instance _ = (y - x) · z # 0f ∋ transport (λ i → o i # 0f) it
-- and so z itself has multiplicative inverse w (y − x).
1≡z·[w·[y-x]] = γ
iii = 1≡z·[w·[y-x]]
1≡[w·[y-x]]·z : 1f ≡ (w · (y - x)) · z
1≡[w·[y-x]]·z = transport (λ i → 1f ≡ ·-comm z (w · (y - x)) i) 1≡z·[w·[y-x]]
-- Then since 0 < z and xz < yz, by (∗), we get xzw (y − x) < yzw (y − x), and hence x < y.
instance _ = z # 0f ∋ inr 0<z
z⁻¹ = w · (y - x)
z⁻¹≡w·[y-x] : z ⁻¹ᶠ ≡ (w · (y - x))
z⁻¹≡w·[y-x] = let tmp = sym (snd (·-linv-unique (w · (y - x)) z (sym 1≡[w·[y-x]]·z)))
in transport (cong (λ z#0 → _⁻¹ᶠ z {{z#0}} ≡ (w · (y - x))) (#-isProp z 0f _ _)) tmp
0<z⁻¹ : 0f < z ⁻¹ᶠ
0<z⁻¹ = ⁻¹ᶠ-preserves-sign z 0<z
instance _ = 0f < w · (y - x) ∋ transport (λ i → 0f < z⁻¹≡w·[y-x] i) 0<z⁻¹
-- instance _ = 0f < z⁻¹ ∋ ?
in ( x · z < y · z ⇒⟨ ·-preserves-< _ _ z⁻¹ it ⟩
(x · z) · z⁻¹ < (y · z) · z⁻¹ ⇒⟨ transport (λ i → ·-assoc x z z⁻¹ (~ i) < ·-assoc y z z⁻¹ (~ i)) ⟩
x · (z · z⁻¹) < y · (z · z⁻¹) ⇒⟨ transport (λ i → x · iii (~ i) < y · iii (~ i)) ⟩
x · 1f < y · 1f ⇒⟨ transport (cong₂ _<_ (fst (·-identity x)) (fst (·-identity y))) ⟩
x < y ◼) x·z<y·z
where
abstract -- NOTE: `abstract` is only allowed in `where` blocks and `where` blocks are not allowed in `let` blocks
γ =
let -- NOTE: for some reason the instance resolution does only work in let-blocks
-- I get a "Terms marked as eligible for instance search should end with a name, so `instance' is ignored here. when checking the definition of my-instance"
instance my-instance = ( x · z < y · z ⇒⟨ +-preserves-< _ _ _ ⟩
(x · z) - (x · z) < (y · z) - (x · z) ⇒⟨ transport (cong₂ _<_ (+-rinv (x · z)) refl) ⟩
0f < (y · z) - (x · z) ◼) x·z<y·z
_ = (y · z) - (x · z) # 0f ∋ inr it
-- so that yz − xz has a multiplicative inverse w,
w = ((y · z) - (x · z)) ⁻¹ᶠ
o = ( (y · z) - ( x · z) ≡⟨ ( λ i → (y · z) + (-commutesWithLeft-· x z) (~ i)) ⟩
(y · z) + ((- x) · z) ≡⟨ sym (snd (dist y (- x) z)) ⟩
(y - x) · z ∎)
instance _ = (y - x) · z # 0f ∋ transport (λ i → o i # 0f) it
in (
1f ≡⟨ (λ i → ·-linv ((y · z) - (x · z)) it (~ i)) ⟩
w · ((y · z) - (x · z)) ≡⟨ (λ i → w · o i) ⟩
w · ((y - x) · z) ≡⟨ (λ i → w · ·-comm (y - x) z i ) ⟩
w · (z · (y - x)) ≡⟨ (λ i → ·-assoc w z (y - x) i) ⟩
(w · z) · (y - x) ≡⟨ (λ i → ·-comm w z i · (y - x)) ⟩
(z · w) · (y - x) ≡⟨ (λ i → ·-assoc z w (y - x) (~ i)) ⟩
z · (w · (y - x)) ∎)
-- 10. 0 < 1.
item-10 with snd (·-inv-back _ _ (fst (·-identity 1f)))
-- For item 10, since 1 has multiplicative inverse 1, it is apart from 0, hence 0 < 1 ∨ 1 < 0.
... | inl 1<0 =
-- If 1 < 0 then by item 4 we have 0 < −1 and so by (∗) we get 0 < (−1) · (−1), that is, 0 < 1, so by transitivity 1 < 1, contradicting irreflexivity of <.
(1f < 0f ⇒⟨ +-preserves-< 1f 0f (- 1f) ⟩
1f - 1f < 0f - 1f ⇒⟨ transport (λ i → +-rinv 1f i < snd (+-identity (- 1f)) i) ⟩
0f < - 1f ⇒⟨ ( λ 0<-1 → ·-preserves-< 0f (- 1f) (- 1f) 0<-1 0<-1) ⟩
0f · (- 1f) < (- 1f) · (- 1f) ⇒⟨ transport (cong₂ _<_ (0-leftNullifies (- 1f)) refl) ⟩
0f < (- 1f) · (- 1f) ⇒⟨ transport (λ i → 0f < -commutesWithRight-· (- 1f) (1f) i ) ⟩
0f < -((- 1f) · 1f )⇒⟨ transport (λ i → 0f < -commutesWithLeft-· (- 1f) 1f (~ i)) ⟩
0f < (-(- 1f))· 1f ⇒⟨ transport (λ i → 0f < -involutive 1f i · 1f) ⟩
0f < 1f · 1f ⇒⟨ transport (λ i → 0f < fst (·-identity 1f) i) ⟩
0f < 1f ⇒⟨ <-trans _ _ _ 1<0 ⟩
1f < 1f ⇒⟨ <-irrefl 1f ⟩
⊥ ⇒⟨ ⊥-elim ⟩ _ ◼) 1<0
... | inr 0<1 = 0<1
-- Conversely, assume the 10 listed items—in particular, items 4, 5 and 9.
module back -- 1. 2. 3. 4. 5. ⇒ 6.
-- (item-1 : ∀ x y → x ≤ y → ¬(y < x))
-- (item-1-back : ∀ x y → ¬(y < x) → x ≤ y)
-- (item-2 : ∀ x y → x # y → (x < y) ⊎ (y < x))
-- (item-2-back : ∀ x y → (x < y) ⊎ (y < x) → x # y)
-- (item-3 : ∀ x y z → x ≤ y → x + z ≤ y + z)
-- (item-3-back : ∀ x y z → x + z ≤ y + z → x ≤ y)
(item-4 : ∀ x y z → x < y → x + z < y + z)
-- (item-4-back : ∀ x y z → x + z < y + z → x < y)
(item-5 : ∀ x y → 0f < x + y → (0f < x) ⊎ (0f < y))
-- (item-6 : ∀ x y z → x < y → y ≤ z → x < z)
-- (item-7 : ∀ x y z → x ≤ y → y < z → x < z)
-- (item-8 : ∀ x y z → x ≤ y → 0f ≤ z → x · z ≤ y · z)
(item-9 : ∀ x y z → 0f < z → (x < y → x · z < y · z))
-- (item-9-back : ∀ x y z → 0f < z → (x · z < y · z → x < y))
-- (item-10 : 0f < 1f)
where
item-4' : ∀ x y → 0f < x - y → y < x
item-4' x y = (
0f < x - y ⇒⟨ item-4 0f (x + (- y)) y ⟩
0f + y < (x - y) + y ⇒⟨ transport (λ i → snd (+-identity y) i < sym (+-assoc x (- y) y) i) ⟩
y < x + (- y + y) ⇒⟨ transport (λ i → y < x + snd (+-inv y) i) ⟩
y < x + 0f ⇒⟨ transport (λ i → y < fst (+-identity x) i) ⟩
y < x ◼)
lemma : ∀ x y z w → (z + w) + ((- x) + (- y)) ≡ (z - x) + (w - y)
lemma x y z w = (
-- NOTE: there has to be a shorter way to to this kind of calculations ...
-- also I got not much introspection while creating the paths
(z + w) + ((- x) + (- y)) ≡⟨ ( λ i → +-assoc z w ((- x) + (- y)) (~ i)) ⟩
(z + ( w + ((- x) + (- y)))) ≡⟨ ( λ i → z + (+-assoc w (- x) (- y) i)) ⟩
(z + ((w + (- x)) + (- y))) ≡⟨ ( λ i → z + ((+-comm w (- x) i) + (- y)) ) ⟩
(z + (((- x) + w) + (- y))) ≡⟨ ( λ i → z + (+-assoc (- x) w (- y) (~ i))) ⟩
(z + (( - x) + (w - y))) ≡⟨ ( λ i → +-assoc z (- x) (w - y) i ) ⟩
(z - x) + (w - y) ∎)
-- 6. (†)
-- In order to show (†), suppose x + y < z + w.
-- So, by item 4, we get (x + y) − (x + y) < (z + w) − (x + y), that is, 0 < (z − x) + (w − y).
-- By item 5, (0 < z − x) ∨ (0 < w − y), and so by item 4 in either case, we get x < z ∨ y < w.
+-<-extensional : ∀ w x y z → (x + y) < (z + w) → (x < z) ⊎ (y < w)
+-<-extensional w x y z = (
(x + y) < (z + w) ⇒⟨ item-4 (x + y) (z + w) (- (x + y)) ⟩
(x + y) - (x + y) < (z + w) - (x + y)
⇒⟨ transport (λ i → +-rinv (x + y) i < (z + w) + (-isDistributive x y) (~ i)) ⟩
0f < (z + w) + ((- x) + (- y)) ⇒⟨ transport (λ i → 0f < lemma x y z w i) ⟩
0f < (z - x) + (w - y) ⇒⟨ item-5 (z - x) (w - y) ⟩
(0f < z - x) ⊎ (0f < w - y) ⇒⟨ (λ{ (inl p) → inl (item-4' z x p)
; (inr p) → inr (item-4' w y p)}) ⟩
( x < z ) ⊎ ( y < w ) ◼)
-- 6. (∗)
·-preserves-< : ∀ x y z → 0f < z → x < y → (x · z) < (y · z)
·-preserves-< = item-9
|
*Guest blog content provided by freshbenies.
How many Benefits Administration systems did you work with last year versus 5 years ago? Like you, we’ve seen a few different companies with multiple options over the years– and a lot more in recent years. They’re getting smarter and more efficient, and that’s good because today, most medium to large-size employers already have or are considering a benefit administration system.
Of course, the goal is to deliver benefits to employees in a more efficient manner, and we should be prepared to help with the decision-making process.
On that note, here are 3 key areas of functionality to consider when reviewing a new or current system.
Consolidation of services – with support!
The system should handle multiple carriers and offer enrollment for all employee benefits. This involves seamless connectivity for eligibility feeds to all carriers. The “holy grail” everyone is looking for is integration with a payroll system. True integration allows for one point of input for employee information, plus payroll deductions carried from the benefits system to the payroll system (That would make life a little easier, right?).
Are account management and technical support available when setting up feeds?
How are errors, reconciliation and auditing of data handled?
What compliance reports are available?
The trend is headed toward paperless and self-service enrollment. What specific features are required to meet this need?
Employees should be able to enroll in all benefits via the system, including voluntary benefits with the necessary restrictions for participation.
Benefit descriptions should be easily available in the system or via links.
HSA and FSA contributions should be captured.
Costs should be presented on a “per paycheck” basis.
Defined contributions will require credit bank functionality so employees can shop for benefits and use credits.
Bonus functionality would allow employees to order ID cards, update addresses and change benefits due to qualifying events. HR should be notified when a change is made and be able to track these changes in a date range. Based on the love affair Americans have with their phones, the demand for systems with mobile app enrollment will likely increase. Ask if the system offers this technology now or plans to in the near future.
As they say, content is king. Cutting-edge systems will allow for delivery of critical messages and serve as a central repository for relevant news and updates. This will be an important trend going forward because it facilitates efficient communication between benefit advisors and employers, as well as between employers and employees.
Internally, the employer can deliver useful information to employees and draw them to the site. Where do employees go for information now and how can the system help provide a better, more convenient information source? The portal can also include health and nutritional information, new medical breakthroughs and lifestyle information as a start.
We all know how hard it is to sort through emails and take note of all the information they contain. The importance of a central go-to information source will only increase for you and your employees.
There are many systems out there that provide a varying mix of these functions. It’s important to discuss these possibilities with your employee benefits broker as part of your overall benefits strategy.
At Sonus Benefits, we build cost effective, long-lasting benefits strategies to keep your business and your employees in optimum health. Located in Kirkwood, MO, we help clients throughout the greater St. Louis area identify and manage complex employee benefits challenges. If you want help managing your employee programs, we may be the insurance consultant and business partner you need. |
-- Andreas, 2011-05-10
module MetaAppUnderLambda where
data _≡_ {A : Set} (a : A) : A -> Set where
refl : a ≡ a
data D (A : Set) : Set where
cons : A -> (A -> A) -> D A
f : {A : Set} -> D A -> A
f (cons a h) = a
test : (A : Set) ->
let X : A
X = _
Y : A -> A
Y = λ v -> _ v
in f (cons X Y) ≡ X
test A = refl
-- should return "Unsolved Metas"
-- executes the defauls A.App case in the type checker (which is not covered by appView) |
-- Algorithmic equality.
{-# OPTIONS --safe #-}
module Definition.Conversion where
open import Definition.Untyped
open import Definition.Typed
open import Tools.Nat
import Tools.PropositionalEquality as PE
infix 10 _⊢_~_↑_^_
infix 10 _⊢_[conv↑]_^_
infix 10 _⊢_[conv↓]_^_
infix 10 _⊢_[conv↑]_∷_^_
infix 10 _⊢_[conv↓]_∷_^_
infix 10 _⊢_[genconv↑]_∷_^_
mutual
-- Neutral equality.
data _⊢_~_↑!_^_ (Γ : Con Term) : (k l A : Term) → TypeLevel → Set where
var-refl : ∀ {x y A l}
→ Γ ⊢ var x ∷ A ^ [ ! , l ]
→ x PE.≡ y
→ Γ ⊢ var x ~ var y ↑! A ^ l
app-cong : ∀ {k l t v F rF lF lG G lΠ}
→ Γ ⊢ k ~ l ↓! Π F ^ rF ° lF ▹ G ° lG ° lΠ ^ ι lΠ
→ Γ ⊢ t [genconv↑] v ∷ F ^ [ rF , ι lF ]
→ Γ ⊢ k ∘ t ^ lΠ ~ l ∘ v ^ lΠ ↑! G [ t ] ^ ι lG
natrec-cong : ∀ {k l h g a₀ b₀ F G lF}
→ Γ ∙ ℕ ^ [ ! , ι ⁰ ] ⊢ F [conv↑] G ^ [ ! , ι lF ]
→ Γ ⊢ a₀ [conv↑] b₀ ∷ F [ zero ] ^ ι lF
→ Γ ⊢ h [conv↑] g ∷ Π ℕ ^ ! ° ⁰ ▹ (F ^ ! ° lF ▹▹ F [ suc (var 0) ]↑ ° lF ° lF) ° lF ° lF ^ ι lF
→ Γ ⊢ k ~ l ↓! ℕ ^ ι ⁰
→ Γ ⊢ natrec lF F a₀ h k ~ natrec lF G b₀ g l ↑! F [ k ] ^ ι lF
Emptyrec-cong : ∀ {k l F G ll lEmpty}
→ Γ ⊢ F [conv↑] G ^ [ ! , ι ll ]
→ Γ ⊢ k ~ l ↑% Empty lEmpty ^ ι lEmpty
→ Γ ⊢ Emptyrec ll lEmpty F k ~ Emptyrec ll lEmpty G l ↑! F ^ ι ll
Id-cong : ∀ {l A A' t t' u u'}
→ Γ ⊢ A ~ A' ↓! U l ^ next l
→ Γ ⊢ t [conv↑] t' ∷ A ^ ι l
→ Γ ⊢ u [conv↑] u' ∷ A ^ ι l
→ Γ ⊢ Id A t u ~ Id A' t' u' ↑! SProp l ^ next l
Id-ℕ : ∀ {t t' u u'}
→ Γ ⊢ t ~ t' ↓! ℕ ^ ι ⁰
→ Γ ⊢ u [conv↑] u' ∷ ℕ ^ ι ⁰
→ Γ ⊢ Id ℕ t u ~ Id ℕ t' u' ↑! SProp ⁰ ^ next ⁰
Id-ℕ0 : ∀ {t t'}
→ Γ ⊢ t ~ t' ↓! ℕ ^ ι ⁰
→ Γ ⊢ Id ℕ zero t ~ Id ℕ zero t' ↑! SProp ⁰ ^ next ⁰
Id-ℕS : ∀ {t t' u u'}
→ Γ ⊢ t [conv↑] t' ∷ ℕ ^ ι ⁰
→ Γ ⊢ u ~ u' ↓! ℕ ^ ι ⁰
→ Γ ⊢ Id ℕ (suc t) u ~ Id ℕ (suc t') u' ↑! SProp ⁰ ^ next ⁰
Id-U : ∀ {t t' u u'}
→ Γ ⊢ t ~ t' ↓! U ⁰ ^ ι ¹
→ Γ ⊢ u [conv↑] u' ∷ U ⁰ ^ ι ¹
→ Γ ⊢ Id (U ⁰) t u ~ Id (U ⁰) t' u' ↑! SProp ¹ ^ next ¹
Id-Uℕ : ∀ {t t'}
→ Γ ⊢ t ~ t' ↓! U ⁰ ^ ι ¹
→ Γ ⊢ Id (U ⁰) ℕ t ~ Id (U ⁰) ℕ t' ↑! SProp ¹ ^ next ¹
Id-UΠ : ∀ {A rA B A' B' t t'}
→ Γ ⊢ Π A ^ rA ° ⁰ ▹ B ° ⁰ ° ⁰ [conv↑] Π A' ^ rA ° ⁰ ▹ B' ° ⁰ ° ⁰ ∷ U ⁰ ^ ι ¹
→ Γ ⊢ t ~ t' ↓! U ⁰ ^ ι ¹
→ Γ ⊢ Id (U ⁰) (Π A ^ rA ° ⁰ ▹ B ° ⁰ ° ⁰ ) t ~ Id (U ⁰) (Π A' ^ rA ° ⁰ ▹ B' ° ⁰ ° ⁰ ) t' ↑! SProp ¹ ^ next ¹
cast-cong : ∀ {A A' B B' t t' e e'}
→ Γ ⊢ A ~ A' ↓! U ⁰ ^ next ⁰
→ Γ ⊢ B [conv↑] B' ∷ U ⁰ ^ ι ¹
→ Γ ⊢ t [conv↑] t' ∷ A ^ ι ⁰
→ Γ ⊢ e ∷ (Id (U ⁰) A B) ^ [ % , next ⁰ ]
→ Γ ⊢ e' ∷ (Id (U ⁰) A' B') ^ [ % , next ⁰ ]
→ Γ ⊢ cast ⁰ A B e t ~ cast ⁰ A' B' e' t' ↑! B ^ ι ⁰
cast-ℕ : ∀ {A A' t t' e e'}
→ Γ ⊢ A ~ A' ↓! U ⁰ ^ next ⁰
→ Γ ⊢ t [conv↑] t' ∷ ℕ ^ ι ⁰
→ Γ ⊢ e ∷ (Id (U ⁰) ℕ A) ^ [ % , next ⁰ ]
→ Γ ⊢ e' ∷ (Id (U ⁰) ℕ A') ^ [ % , next ⁰ ]
→ Γ ⊢ cast ⁰ ℕ A e t ~ cast ⁰ ℕ A' e' t' ↑! A ^ ι ⁰
cast-ℕℕ : ∀ {t t' e e'}
→ Γ ⊢ t ~ t' ↓! ℕ ^ ι ⁰
→ Γ ⊢ e ∷ (Id (U ⁰) ℕ ℕ) ^ [ % , next ⁰ ]
→ Γ ⊢ e' ∷ (Id (U ⁰) ℕ ℕ) ^ [ % , next ⁰ ]
→ Γ ⊢ cast ⁰ ℕ ℕ e t ~ cast ⁰ ℕ ℕ e' t' ↑! ℕ ^ ι ⁰
cast-Π : ∀ {A rA P A' P' B B' t t' e e'}
→ Γ ⊢ Π A ^ rA ° ⁰ ▹ P ° ⁰ ° ⁰ [conv↑] Π A' ^ rA ° ⁰ ▹ P' ° ⁰ ° ⁰ ∷ U ⁰ ^ next ⁰
→ Γ ⊢ B ~ B' ↓! U ⁰ ^ next ⁰
→ Γ ⊢ t [conv↑] t' ∷ Π A ^ rA ° ⁰ ▹ P ° ⁰ ° ⁰ ^ ι ⁰
→ Γ ⊢ e ∷ (Id (U ⁰) (Π A ^ rA ° ⁰ ▹ P ° ⁰ ° ⁰ ) B) ^ [ % , next ⁰ ]
→ Γ ⊢ e' ∷ (Id (U ⁰) (Π A' ^ rA ° ⁰ ▹ P' ° ⁰ ° ⁰ ) B') ^ [ % , next ⁰ ]
→ Γ ⊢ cast ⁰ (Π A ^ rA ° ⁰ ▹ P ° ⁰ ° ⁰ ) B e t ~ cast ⁰ (Π A' ^ rA ° ⁰ ▹ P' ° ⁰ ° ⁰ ) B' e' t' ↑! B ^ ι ⁰
cast-Πℕ : ∀ {A rA P A' P' t t' e e'}
→ Γ ⊢ Π A ^ rA ° ⁰ ▹ P ° ⁰ ° ⁰ [conv↑] Π A' ^ rA ° ⁰ ▹ P' ° ⁰ ° ⁰ ∷ U ⁰ ^ ι ¹
→ Γ ⊢ t [conv↑] t' ∷ Π A ^ rA ° ⁰ ▹ P ° ⁰ ° ⁰ ^ ι ⁰
→ Γ ⊢ e ∷ (Id (U ⁰) (Π A ^ rA ° ⁰ ▹ P ° ⁰ ° ⁰ ) ℕ) ^ [ % , next ⁰ ]
→ Γ ⊢ e' ∷ (Id (U ⁰) (Π A' ^ rA ° ⁰ ▹ P' ° ⁰ ° ⁰ ) ℕ) ^ [ % , next ⁰ ]
→ Γ ⊢ cast ⁰ (Π A ^ rA ° ⁰ ▹ P ° ⁰ ° ⁰ ) ℕ e t ~ cast ⁰ (Π A' ^ rA ° ⁰ ▹ P' ° ⁰ ° ⁰ ) ℕ e' t' ↑! ℕ ^ ι ⁰
cast-ℕΠ : ∀ {A rA P A' P' t t' e e'}
→ Γ ⊢ Π A ^ rA ° ⁰ ▹ P ° ⁰ ° ⁰ [conv↑] Π A' ^ rA ° ⁰ ▹ P' ° ⁰ ° ⁰ ∷ U ⁰ ^ ι ¹
→ Γ ⊢ t [conv↑] t' ∷ ℕ ^ ι ⁰
→ Γ ⊢ e ∷ (Id (U ⁰) ℕ (Π A ^ rA ° ⁰ ▹ P ° ⁰ ° ⁰ )) ^ [ % , next ⁰ ]
→ Γ ⊢ e' ∷ (Id (U ⁰) ℕ (Π A' ^ rA ° ⁰ ▹ P' ° ⁰ ° ⁰ )) ^ [ % , next ⁰ ]
→ Γ ⊢ cast ⁰ ℕ (Π A ^ rA ° ⁰ ▹ P ° ⁰ ° ⁰ ) e t ~ cast ⁰ ℕ (Π A' ^ rA ° ⁰ ▹ P' ° ⁰ ° ⁰ ) e' t' ↑! (Π A ^ rA ° ⁰ ▹ P ° ⁰ ° ⁰ ) ^ ι ⁰
cast-ΠΠ%! : ∀ {A P A' P' B Q B' Q' t t' e e'}
→ Γ ⊢ Π A ^ % ° ⁰ ▹ P ° ⁰ ° ⁰ [conv↑] Π A' ^ % ° ⁰ ▹ P' ° ⁰ ° ⁰ ∷ U ⁰ ^ ι ¹
→ Γ ⊢ Π B ^ ! ° ⁰ ▹ Q ° ⁰ ° ⁰ [conv↑] Π B' ^ ! ° ⁰ ▹ Q' ° ⁰ ° ⁰ ∷ U ⁰ ^ ι ¹
→ Γ ⊢ t [conv↑] t' ∷ Π A ^ % ° ⁰ ▹ P ° ⁰ ° ⁰ ^ ι ⁰
→ Γ ⊢ e ∷ (Id (U ⁰) (Π A ^ % ° ⁰ ▹ P ° ⁰ ° ⁰ ) (Π B ^ ! ° ⁰ ▹ Q ° ⁰ ° ⁰ )) ^ [ % , next ⁰ ]
→ Γ ⊢ e' ∷ (Id (U ⁰) (Π A' ^ % ° ⁰ ▹ P' ° ⁰ ° ⁰ ) (Π B' ^ ! ° ⁰ ▹ Q' ° ⁰ ° ⁰ )) ^ [ % , next ⁰ ]
→ Γ ⊢ cast ⁰ (Π A ^ % ° ⁰ ▹ P ° ⁰ ° ⁰ ) (Π B ^ ! ° ⁰ ▹ Q ° ⁰ ° ⁰ ) e t ~
cast ⁰ (Π A' ^ % ° ⁰ ▹ P' ° ⁰ ° ⁰ ) (Π B' ^ ! ° ⁰ ▹ Q' ° ⁰ ° ⁰ ) e' t' ↑! (Π B ^ ! ° ⁰ ▹ Q ° ⁰ ° ⁰ ) ^ ι ⁰
cast-ΠΠ!% : ∀ {A P A' P' B Q B' Q' t t' e e'}
→ Γ ⊢ Π A ^ ! ° ⁰ ▹ P ° ⁰ ° ⁰ [conv↑] Π A' ^ ! ° ⁰ ▹ P' ° ⁰ ° ⁰ ∷ U ⁰ ^ ι ¹
→ Γ ⊢ Π B ^ % ° ⁰ ▹ Q ° ⁰ ° ⁰ [conv↑] Π B' ^ % ° ⁰ ▹ Q' ° ⁰ ° ⁰ ∷ U ⁰ ^ ι ¹
→ Γ ⊢ t [conv↑] t' ∷ Π A ^ ! ° ⁰ ▹ P ° ⁰ ° ⁰ ^ ι ⁰
→ Γ ⊢ e ∷ (Id (U ⁰) (Π A ^ ! ° ⁰ ▹ P ° ⁰ ° ⁰ ) (Π B ^ % ° ⁰ ▹ Q ° ⁰ ° ⁰ )) ^ [ % , next ⁰ ]
→ Γ ⊢ e' ∷ (Id (U ⁰) (Π A' ^ ! ° ⁰ ▹ P' ° ⁰ ° ⁰ ) (Π B' ^ % ° ⁰ ▹ Q' ° ⁰ ° ⁰ )) ^ [ % , next ⁰ ]
→ Γ ⊢ cast ⁰ (Π A ^ ! ° ⁰ ▹ P ° ⁰ ° ⁰ ) (Π B ^ % ° ⁰ ▹ Q ° ⁰ ° ⁰ ) e t ~
cast ⁰ (Π A' ^ ! ° ⁰ ▹ P' ° ⁰ ° ⁰ ) (Π B' ^ % ° ⁰ ▹ Q' ° ⁰ ° ⁰ ) e' t' ↑! (Π B ^ % ° ⁰ ▹ Q ° ⁰ ° ⁰ ) ^ ι ⁰
record _⊢_~_↑%_^_ (Γ : Con Term) (k l A : Term) (ll : TypeLevel) : Set where
inductive
constructor %~↑
field
⊢k : Γ ⊢ k ∷ A ^ [ % , ll ]
⊢l : Γ ⊢ l ∷ A ^ [ % , ll ]
data _⊢_~_↑_^_ (Γ : Con Term) : (k l A : Term) → TypeInfo → Set where
~↑! : ∀ {k l A ll} → Γ ⊢ k ~ l ↑! A ^ ll → Γ ⊢ k ~ l ↑ A ^ [ ! , ll ]
~↑% : ∀ {k l A ll} → Γ ⊢ k ~ l ↑% A ^ ll → Γ ⊢ k ~ l ↑ A ^ [ % , ll ]
-- Neutral equality with types in WHNF.
record _⊢_~_↓!_^_ (Γ : Con Term) (k l B : Term) (ll : TypeLevel) : Set where
inductive
constructor [~]
field
A : Term
D : Γ ⊢ A ⇒* B ^ [ ! , ll ]
whnfB : Whnf B
k~l : Γ ⊢ k ~ l ↑! A ^ ll
-- Type equality.
record _⊢_[conv↑]_^_ (Γ : Con Term) (A B : Term) (rA : TypeInfo) : Set where
inductive
constructor [↑]
field
A′ B′ : Term
D : Γ ⊢ A ⇒* A′ ^ rA
D′ : Γ ⊢ B ⇒* B′ ^ rA
whnfA′ : Whnf A′
whnfB′ : Whnf B′
A′<>B′ : Γ ⊢ A′ [conv↓] B′ ^ rA
-- Type equality with types in WHNF.
data _⊢_[conv↓]_^_ (Γ : Con Term) : (A B : Term) → TypeInfo → Set where
U-refl : ∀ {r r' }
→ r PE.≡ r' -- needed for K issues
→ ⊢ Γ → Γ ⊢ Univ r ¹ [conv↓] Univ r' ¹ ^ [ ! , next ¹ ]
univ : ∀ {A B r l}
→ Γ ⊢ A [conv↓] B ∷ Univ r l ^ next l
→ Γ ⊢ A [conv↓] B ^ [ r , ι l ]
-- Term equality.
record _⊢_[conv↑]_∷_^_ (Γ : Con Term) (t u A : Term) (l : TypeLevel) : Set where
inductive
constructor [↑]ₜ
field
B t′ u′ : Term
D : Γ ⊢ A ⇒* B ^ [ ! , l ]
d : Γ ⊢ t ⇒* t′ ∷ B ^ l
d′ : Γ ⊢ u ⇒* u′ ∷ B ^ l
whnfB : Whnf B
whnft′ : Whnf t′
whnfu′ : Whnf u′
t<>u : Γ ⊢ t′ [conv↓] u′ ∷ B ^ l
-- Term equality with types and terms in WHNF.
data _⊢_[conv↓]_∷_^_ (Γ : Con Term) : (t u A : Term) (l : TypeLevel) → Set where
U-refl : ∀ {r r' }
→ r PE.≡ r' -- needed for K issues
→ ⊢ Γ → Γ ⊢ Univ r ⁰ [conv↓] Univ r' ⁰ ∷ U ¹ ^ next ¹
ne : ∀ {r K L lU l}
→ Γ ⊢ K ~ L ↓! Univ r lU ^ l
→ Γ ⊢ K [conv↓] L ∷ Univ r lU ^ l
ℕ-refl : ⊢ Γ → Γ ⊢ ℕ [conv↓] ℕ ∷ U ⁰ ^ next ⁰
Empty-refl : ∀ {l ll} → ll PE.≡ next l → ⊢ Γ → Γ ⊢ Empty l [conv↓] Empty l ∷ SProp l ^ ll
Π-cong : ∀ {F G H E rF rH rΠ lF lH lG lE lΠ ll}
→ ll PE.≡ next lΠ
→ rF PE.≡ rH -- needed for K issues
→ lF PE.≡ lH -- needed for K issues
→ lG PE.≡ lE -- needed for K issues
→ lF ≤ lΠ
→ lG ≤ lΠ
→ Γ ⊢ F ^ [ rF , ι lF ]
→ Γ ⊢ F [conv↑] H ∷ Univ rF lF ^ next lF
→ Γ ∙ F ^ [ rF , ι lF ] ⊢ G [conv↑] E ∷ Univ rΠ lG ^ next lG
→ Γ ⊢ Π F ^ rF ° lF ▹ G ° lG ° lΠ [conv↓] Π H ^ rH ° lH ▹ E ° lE ° lΠ ∷ Univ rΠ lΠ ^ ll
∃-cong : ∀ {F G H E l ll}
→ ll PE.≡ next l
→ Γ ⊢ F ^ [ % , ι l ]
→ Γ ⊢ F [conv↑] H ∷ SProp l ^ next l
→ Γ ∙ F ^ [ % , ι l ] ⊢ G [conv↑] E ∷ SProp l ^ next l
→ Γ ⊢ ∃ F ▹ G [conv↓] ∃ H ▹ E ∷ SProp l ^ ll
ℕ-ins : ∀ {k l}
→ Γ ⊢ k ~ l ↓! ℕ ^ ι ⁰
→ Γ ⊢ k [conv↓] l ∷ ℕ ^ ι ⁰
ne-ins : ∀ {k l M N ll}
→ Γ ⊢ k ∷ N ^ [ ! , ι ll ]
→ Γ ⊢ l ∷ N ^ [ ! , ι ll ]
→ Neutral N
→ Γ ⊢ k ~ l ↓! M ^ ι ll
→ Γ ⊢ k [conv↓] l ∷ N ^ ι ll
zero-refl : ⊢ Γ → Γ ⊢ zero [conv↓] zero ∷ ℕ ^ ι ⁰
suc-cong : ∀ {m n}
→ Γ ⊢ m [conv↑] n ∷ ℕ ^ ι ⁰
→ Γ ⊢ suc m [conv↓] suc n ∷ ℕ ^ ι ⁰
η-eq : ∀ {f g F G rF lF lG l}
→ lF ≤ l
→ lG ≤ l
→ Γ ⊢ F ^ [ rF , ι lF ]
→ Γ ⊢ f ∷ Π F ^ rF ° lF ▹ G ° lG ° l ^ [ ! , ι l ]
→ Γ ⊢ g ∷ Π F ^ rF ° lF ▹ G ° lG ° l ^ [ ! , ι l ]
→ Function f
→ Function g
→ Γ ∙ F ^ [ rF , ι lF ] ⊢ wk1 f ∘ var 0 ^ l [conv↑] wk1 g ∘ var 0 ^ l ∷ G ^ ι lG
→ Γ ⊢ f [conv↓] g ∷ Π F ^ rF ° lF ▹ G ° lG ° l ^ ι l
_⊢_[genconv↑]_∷_^_ : (Γ : Con Term) (t u A : Term) (r : TypeInfo) → Set
_⊢_[genconv↑]_∷_^_ Γ k l A [ ! , ll ] = Γ ⊢ k [conv↑] l ∷ A ^ ll
_⊢_[genconv↑]_∷_^_ Γ k l A [ % , ll ] = Γ ⊢ k ~ l ↑% A ^ ll
var-refl′ : ∀ {Γ x A rA ll}
→ Γ ⊢ var x ∷ A ^ [ rA , ll ]
→ Γ ⊢ var x ~ var x ↑ A ^ [ rA , ll ]
var-refl′ {rA = !} ⊢x = ~↑! (var-refl ⊢x PE.refl)
var-refl′ {rA = %} ⊢x = ~↑% (%~↑ ⊢x ⊢x)
|
# James Rekow
computeSubgroupVec = function(M , numSubgroups){
# ARGS: M - number of samples in cohort
# numSubgroups - number of subgroups in cohort
#
# RETURNS: subgroupVec - numeric vector of length M whose ith value is the index of the default subgroup
# to which the ith sample in the cohort will belong, assuming the cohort was
# created using subgroupsAbdListCreator
source("partition.r")
# compute the number of samples in each subgroup
subgroupSizes = partition(n = M, numPartitions = numSubgroups)
# create subgroupList
subgroupList = lapply(as.list(1:numSubgroups), function(ii) rep(ii, subgroupSizes[ii]))
# unlist into a vector
subgroupVec = unlist(subgroupList)
return(subgroupVec)
} # end computeSubgroupVec function
|
\documentclass[12pt,english]{article}
\usepackage[utf8]{inputenc}
\usepackage{blindtext}
\usepackage{listings}
\usepackage{csquotes}
% url package
\usepackage[colorlinks = true,
linkcolor = blue,
urlcolor = blue]{hyperref}
% Titling and Autho
\begin{document}
\begingroup
\centering
\LARGE Repage Document add Responses to Referees to End of File \\[1.5em]
\large \href{http://fanwangecon.github.io/}{Fan Wang} (\href{http://fanwangecon.github.io/Tex4Econ}{Tex4Econ}) \\[1.5em]
\large \today \par
\endgroup
\begin{abstract}
We paginate the main body of the file, re-paginate appendix with letter section headings, then re-paginate a post appendix section with numeric section headings. Final section could be appended file response to referees, which is included with main file to allow for consistent table and graph referencing and citations, but then should be split out as separate file afterwards.
\end{abstract}
\section{Introduction}
\paragraph{Searchs}
\begin{itemize}
\item latex reset page number
\end{itemize}
\paragraph{Code} Core Latex
\begin{lstlisting}
% Reset Appendix
\pagenumbering{arabic}
\setcounter{page}{1}
% Reset Response to Referee
\setcounter{section}{0}
\renewcommand{\thesection}{\arabic{section}}
\end{lstlisting}
\paragraph{Links}
\begin{enumerate}
\item \href{https://tex.stackexchange.com/questions/259085/restart-page-numbering-for-memoir-appendix}{Restart page numbering for memoir appendix}
\end{enumerate}
\section{Data\label{sec:data}}
\Blindtext
\section{Estimation\label{sec:esti}}
\Blindtext
\section{Conclusion}
\blindtext
\pagebreak
\clearpage
\appendix
\pagenumbering{arabic}
\setcounter{page}{1}
\section{Data Details\label{app:data}}
\blindtext
\section{Derivations}
\blindtext
\section{Robustness Checks}
\Blindtext
\pagebreak
\clearpage
\setcounter{section}{0}
\renewcommand{\thesection}{\arabic{section}}
\section{Responses to Editor}
\begin{quotation}
\textbf{AE: }\enquote{\blindtext}
\end{quotation}
In Sections \ref{sec:data} and \ref{app:data}. \blindtext
\subsection{Editor Question One}
\begin{quotation}
\textbf{AE: }\enquote{\blindtext}
\end{quotation}
\blindtext
\clearpage
\pagebreak
\section{Responses to Referee One}
\begin{quotation}
\textbf{R1: }\enquote{\blindtext}
\end{quotation}
\blindtext
\subsection{Referee One Question One}
\begin{quotation}
\textbf{R1: }\enquote{\blindtext}
\end{quotation}
\Blindtext
\subsection{Referee One Question Two}
\begin{quotation}
\textbf{R1: }\enquote{\blindtext}
\end{quotation}
\Blindtext
\end{document}
\end{document}
|
export label_components!
"""
label_components!(lattice::Lattice)
labeling lattice site
"""
function label_components!(sqlattice::Square)
if sqlattice.lattice_config.neighbortype == "nn"
sqlattice.lattice_properties.labeled_lattice_sites = label_components(sqlattice.lattice_config.lattice_sites)
else # next nearest neighbor
sqlattice.lattice_properties.labeled_lattice_sites = label_components(sqlattice.lattice_config.lattice_sites, trues(3,3))
end
sqlattice.lattice_properties.islabeled = true
sqlattice.lattice_properties.nclusters = maximum(sqlattice.lattice_properties.labeled_lattice_sites)
return nothing
end
function label_components!(trilattice::Triangular)
site = trilattice.lattice_config.lattice_sites
row, col = size(site)
labelnum = 0
labeled_site = - Int.(site)
searchlist = Vector{Vector{Int}}()
function checkneighbor!(i,j)
if labeled_site[i,j] == -1
# x o o neighbor
# o o o
# o o x
if j < col && labeled_site[i, j+1] == -1; push!(searchlist, [i, j+1]); end
if 1 < j && labeled_site[i, j-1] == -1; push!(searchlist, [i, j-1]); end
if i < row && labeled_site[i+1, j] == -1; push!(searchlist, [i+1, j]); end
if 1 < i && labeled_site[i-1, j] == -1; push!(searchlist, [i-1, j]); end
if 1 < i && j < col && labeled_site[i-1, j+1] == -1; push!(searchlist, [i-1, j+1]); end
if i < row && 1 < j && labeled_site[i+1, j-1] == -1; push!(searchlist, [i+1, j-1]); end
end
end
@simd for j in 1:col
@simd for i in 1:row
if labeled_site[i,j] == -1
labelnum += 1
checkneighbor!(i,j)
labeled_site[i,j] = labelnum
while !isempty(searchlist)
tmppos = pop!(searchlist)
checkneighbor!(tmppos...)
labeled_site[tmppos...] = labelnum
end
end
end
end
trilattice.lattice_properties.nclusters = labelnum
trilattice.lattice_properties.islabeled = true
trilattice.lattice_properties.labeled_lattice_sites = labeled_site
return nothing
end
function label_components!(hclattice::Honeycomb)
site = hclattice.lattice_config.lattice_sites
row, col = size(site)
labelnum = 0
labeled_site = - Int.(site)
searchlist = Vector{Vector{Int}}()
function checkneighbor!(i,j)
if labeled_site[i,j] == -1
if j < col && labeled_site[i, j+1] == -1; push!(searchlist, [i, j+1]); end # right
if 1 < j && labeled_site[i, j-1] == -1; push!(searchlist, [i, j-1]); end # left
if iseven(i+j)
if 1 < i && labeled_site[i-1, j] == -1; push!(searchlist, [i-1, j]); end # above
else
if i < row && labeled_site[i+1, j] == -1; push!(searchlist, [i+1, j]); end # down
end
end
end
@simd for j in 1:col
@simd for i in 1:row
if labeled_site[i,j] == -1
labelnum += 1
checkneighbor!(i,j)
labeled_site[i,j] = labelnum
while !isempty(searchlist)
tmppos = pop!(searchlist)
checkneighbor!(tmppos...)
labeled_site[tmppos...] = labelnum
end
end
end
end
hclattice.lattice_properties.nclusters = labelnum
hclattice.lattice_properties.islabeled = true
hclattice.lattice_properties.labeled_lattice_sites = labeled_site
return nothing
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.