9. References: Typing Mutable References
Most real languages include impure features ("computational effects")...
-
mutable pointer structures
-
non-local control constructs (exceptions, continuations, etc.)
-
inter-process synchronization and communication
-
etc.
Goal for this chapter: Formalize pointers.
9.1. Definitions
In most real-world programming languages, the mechanisms of name binding and storage allocation are (intentionally) confused: every name refers to a mutable piece of storage.
Conceptually, it's cleaner to separate the two:
-
use the mechanisms we already have for name binding (abstraction, let);
-
introduce new operations for allocating, changing, and looking up the contents of references (pointers).
9.1.1. Syntax
namespace STLCRef
open scoped MyGetElem
The basic operations on references are allocation, dereferencing, and assignment.
-
To allocate a reference, we use the
refoperator, providing an initial value for the new cell.For example,
ref 5creates a new cell containing the value5and reduces to a reference to that cell. -
To read the current value of this cell, we use the dereferencing operator
!.For example,
!(ref 5)reduces to5. -
To change the value stored in a cell, we use the assignment operator.
If
ris a reference,r := 7will store the value7in the cell referenced byr.
9.1.2. Types
If τ is a type, then Ref τ is the type of references to
cells holding values of type τ.
| τ | ::= | Nat | |
| | | Unit | ||
| | | τ → τ | ||
| | | Ref τ |
inductive Ty : Type :=
| nat : Ty
| unit : Ty
| arrow : Ty → Ty → Ty
| ref : Ty → Ty
9.1.3. Terms
Besides the usual variables, abstractions, applications,
terms related to natural numbers, and unit, we need four
more sorts of terms to handle mutable references:
| t | ::= | ref t | (reference) |
| | | ! t | (dereference) | |
| | | t := t | (assignment) | |
| | | l | (location) |
inductive Tm : Type :=
-- STLC with numbers:
| var : String → Tm
| app : Tm → Tm → Tm
| abs : String → Ty → Tm → Tm
| const : Nat → Tm
| succ : Tm → Tm
| pred : Tm → Tm
| mult : Tm → Tm → Tm
| ite0 : Tm → Tm → Tm → Tm
-- New terms:
| unit : Tm
| ref : Tm → Tm
| deref : Tm → Tm
| assign : Tm → Tm → Tm
| loc : Nat → Tm
Notation
scoped syntax:max num : stlcTm
scoped syntax:60 stlcTm:60 " * " stlcTm:61 : stlcTm
scoped syntax:50 "if0 " stlcTm:51 " then " stlcTm:50 " else " stlcTm:50 : stlcTm
scoped syntax:60 stlcTm:60 " := " stlcTm:61 : stlcTm
scoped syntax:60 "Ref " stlcTy:61 : stlcTy
scoped syntax:60 "ref " stlcTm:61 : stlcTm
scoped syntax:60 "loc " stlcTm:61 : stlcTm
scoped syntax:60 "!" stlcTm:61 : stlcTm
scoped syntax:55 stlcTm:56 " ; " stlcTm:55 : stlcTm
scoped syntax stlcCtx " / " term:max " ⊢ " stlcTm " ⦂ " stlcTy : stlcQuoted
abbrev Tm.tseq t₁ t₂ :=
Tm.app (.abs "X" .unit t₂) t₁
namespace Elab
open StlcCommon
open Lean Meta Elab Term
def language : Language where
tyType := ``Ty
tmType := ``Tm
arrowCtor := ``Ty.arrow
varCtor := ``Tm.var
appCtor := ``Tm.app
absCtor := ``Tm.abs
-- defined later
subst := `STLCRef.subst
hasType := `STLCRef.HasType
def extendedTyHandler : TyElabHandler :=
fun recur k T => do
match T with
| `(stlcTy| Nat) =>
return mkConst ``Ty.nat
| `(stlcTy| Unit) =>
return mkConst ``Ty.unit
| `(stlcTy| Ref $τ:stlcTy) => do
let τ ← recur τ
return mkApp (mkConst ``Ty.ref) τ
| _ => k T
def tyHandlers : TyElabHandler :=
extendedTyHandler.orElse (commonTyHandler language)
partial def elabTy : TyElab :=
tyHandlers elabTy <| unsupportedTy language
def extendedTmHandler : TmElabHandler :=
fun recur k Γ free t => do
match t with
| `(stlcTm| $n:num) => do
return (mkApp (mkConst ``Tm.const) (mkNatLit n.getNat), free )
| `(stlcTm| Nat) => do
throwError "`Nat` is not a valid term."
| `(stlcTm| succ $t:stlcTm) => do
let (t, free) ← recur Γ free t
return (mkApp (mkConst ``Tm.succ) t, free)
| `(stlcTm| pred $t:stlcTm) => do
let (t, free) ← recur Γ free t
return (mkApp (mkConst ``Tm.pred) t, free)
| `(stlcTm| $t₁:stlcTm * $t₂:stlcTm) => do
let (t₁, free) ← recur Γ free t₁
let (t₂, free) ← recur Γ free t₂
return (mkApp2 (mkConst ``Tm.mult) t₁ t₂, free)
| `(stlcTm| if0 $c:stlcTm then $t:stlcTm else $e:stlcTm) => do
let (c, free) ← recur Γ free c
let (t, free) ← recur Γ free t
let (e, free) ← recur Γ free e
return (mkApp3 (mkConst ``Tm.ite0) c t e, free)
| `(stlcTm| Unit) => do
throwError "`Unit` is not a valid term."
| `(stlcTm| unit) => do
return (mkConst ``Tm.unit, free)
| `(stlcTm| ref $t:stlcTm) => do
let (t, free) ← recur Γ free t
return (mkApp (mkConst ``Tm.ref) t, free)
| `(stlcTm| !$t:stlcTm) => do
let (t, free) ← recur Γ free t
return (mkApp (mkConst ``Tm.deref) t, free)
| `(stlcTm| loc $n:num) => do
return (mkApp (mkConst ``Tm.loc) (mkNatLit n.getNat), free )
| `(stlcTm| $t₁:stlcTm := $t₂:stlcTm) => do
let (t₁, free) ← recur Γ free t₁
let (t₂, free) ← recur Γ free t₂
return (mkApp2 (mkConst ``Tm.assign) t₁ t₂, free)
| `(stlcTm| $t₁:stlcTm ; $t₂:stlcTm) => do
let (t₁, free) ← recur Γ free t₁
let (t₂, free) ← recur Γ free t₂
return (mkApp2 (mkConst ``Tm.tseq) t₁ t₂, free)
| _ => k Γ free t
def tmHandlers : TmElabHandler :=
extendedTmHandler.orElse (commonTmHandler language elabTy)
partial def elabTm : TmElab :=
tmHandlers elabTm unsupportedTm
def elabCtx : CtxElab := elabCtxCommon language elabTy
-- `HasType` takes the store typing as an extra first argument,
-- so we build typing judgments here instead of in `elabQuoted`.
def mkHasType (δ Γ t T : Expr) : TermElabM Expr := do
let some hasType ← resolveId? (mkIdent language.hasType)
| throwError "unknown declaration `{language.hasType}`"
return mkApp4 hasType δ Γ t T
@[scoped term_elab StlcCommon.bracket]
def elabBracket : TermElab :=
fun stx expectedType? => do
match stx with
| `(<{ $Γ:stlcCtx / $δ:term ⊢ $t:stlcTm ⦂ $T:stlcTy }>) => do
let (Γ, scope) ← elabCtx Γ
let (t, _) ← elabTm scope [] t
let T ← elabTy T
let δ ← elabTermEnsuringType δ (mkApp (mkConst ``List [levelZero]) (mkConst ``Ty))
mkHasType δ Γ t T
| `(<{ $_:stlcCtx ⊢ $_:stlcTm ⦂ $_:stlcTy }>) =>
throwError "typing judgments need a store typing: write `Γ / δ ⊢ t ⦂ τ`"
| `(<{ $q:stlcQuoted }>) =>
elabQuoted language elabTy elabTm elabCtx q expectedType?
| _ => throwUnsupportedSyntax
end Elab
open scoped Elab
namespace Delab
open StlcCommon Elab Delab
open Lean PrettyPrinter Delaborator
@[app_unexpander Ty.nat]
private def Ty.unexpandNat : Unexpander
| stx => do
let Nat := mkObjectIdentFrom stx "Nat"
let T ← `(stlcTy| $Nat:ident)
`(<{ $T:stlcTy }>)
@[app_unexpander Ty.unit]
private def Ty.unexpandUnit : Unexpander
| stx => do
let Unit := mkObjectIdentFrom stx "Unit"
let T ← `(stlcTy| $Unit:ident)
`(<{ $T:stlcTy }>)
@[app_unexpander Ty.arrow]
private def Ty.unexpandArrow : Unexpander := Delab.unexpandArrow
@[app_unexpander Ty.ref]
private def Ty.unexpandRef : Unexpander
| `($_ $T) => do
let T' := getTy T
`(<{ Ref $T':stlcTy }>)
| _ => throw ()
private def reservedNames : String → Bool
| "Nat" | "Unit" | "succ" | "pred"
| "if0" | "ref" | "loc" | "Ref"
| "unit" => true
| _ => false
@[app_unexpander Tm.var]
private def Tm.unexpandVar : Unexpander := Delab.unexpandVar reservedNames ``Tm.var
@[app_delab Tm.var]
private def Tm.delabVar : Delab := Delab.delabVar ``Tm.var
@[app_unexpander Tm.app]
private def Tm.unexpandApp : Unexpander := Delab.unexpandApp
@[app_unexpander Tm.abs]
private def Tm.unexpandAbs : Unexpander := Delab.unexpandAbs
@[app_unexpander Tm.const]
private def Tm.unexpandConst : Unexpander
| `($_ $n:num) => `(<{ $n:num }>)
| _ => throw ()
@[app_unexpander Tm.succ]
private def Tm.unexpandSucc : Unexpander
| stx@`($_ $t) => do
let succ := mkObjectIdentFrom stx "succ"
let t' := getTm t
`(<{ $succ:ident $t':stlcTm }>)
| _ => throw ()
@[app_unexpander Tm.pred]
private def Tm.unexpandPred : Unexpander
| stx@`($_ $t) => do
let pred := mkObjectIdentFrom stx "pred"
let t' := getTm t
`(<{ $pred:ident $t':stlcTm }>)
| _ => throw ()
@[app_unexpander Tm.mult]
private def Tm.unexpandMult : Unexpander
| `($_ $t₁ $t₂) => do
let t₁' := getTm t₁
let t₂' := getTm t₂
`(<{ $t₁':stlcTm * $t₂':stlcTm }>)
| _ => throw ()
@[app_unexpander Tm.tseq]
private def Tm.unexpandTseq : Unexpander
| `($_ $t₁ $t₂) => do
let t₁' := getTm t₁
let t₂' := getTm t₂
`(<{ $t₁':stlcTm ; $t₂':stlcTm }>)
| _ => throw ()
@[app_unexpander Tm.ite0]
private def Tm.unexpandIte0 : Unexpander
| `($_ $c $t $e) => do
let c' := getTm c
let t' := getTm t
let e' := getTm e
`(<{ if0 $c':stlcTm then $t':stlcTm else $e':stlcTm }>)
| _ => throw ()
@[app_unexpander Tm.unit]
private def Tm.unexpandUnit : Unexpander
| stx => do
let unit := mkObjectIdentFrom stx "unit"
let t ← `(stlcTm| $unit:ident)
`(<{ $t:stlcTm }>)
@[app_unexpander Tm.assign]
private def Tm.unexpandAssign : Unexpander
| `($_ $t₁ $t₂) => do
let t₁' := getTm t₁
let t₂' := getTm t₂
`(<{ $t₁':stlcTm := $t₂':stlcTm }>)
| _ => throw ()
@[app_unexpander Tm.ref]
private def Tm.unexpandRef : Unexpander
| `($_ $t₁) => do
let t₁' := getTm t₁
`(<{ ref $t₁':stlcTm }>)
| _ => throw ()
@[app_unexpander Tm.deref]
private def Tm.unexpandDeref : Unexpander
| `($_ $t₁) => do
let t₁' := getTm t₁
`(<{ !$t₁':stlcTm }>)
| _ => throw ()
@[app_unexpander Tm.loc]
private def Tm.unexpandLoc : Unexpander
| `($_ $n:num) => `(<{ loc $n:num }>)
| _ => throw ()
end Delab
9.1.4. Typing (Preview)
Informally, the typing rules for allocation, dereferencing, and assignment look roughly like this:
Γ ⊢ t₁ ⦂ τ₁
--------------------- (ref)
Γ ⊢ ref t₁ ⦂ Ref τ₁
Γ ⊢ t₁ ⦂ Ref τ₁
--------------------- (deref)
Γ ⊢ !t₁ ⦂ τ₁
Γ ⊢ t₁ ⦂ Ref τ₂
Γ ⊢ t₂ ⦂ τ₂
--------------------- (assign)
Γ ⊢ t₁ := t₂ ⦂ Unit
The rule for locations will require a bit more machinery, and this will motivate some changes to the other rules; we'll come back to this later.
9.1.5. Values and Substitution
Besides abstractions, numbers, and the unit value, we have one new type of value: locations.
A location is a concrete pointer value — think of it like an address
in memory. Locations should never be written directly by programmers;
they are used to keep track of the intermediate states of programs
involving references. In particular, the result of a ref expression
is a location.
inductive Tm.IsValue : Tm → Prop :=
| abs : forall x τ₂ t₁,
IsValue <{λx : τ₂. t₁}>
| nat : forall (n : Nat),
IsValue (.const n)
| unit :
IsValue <{ unit }>
| loc_ : forall (l : Nat),
IsValue (.loc l)
attribute [StlcRefEval] Tm.IsValue.abs Tm.IsValue.nat Tm.IsValue.unit Tm.IsValue.loc_
Extending substitution to handle the new syntax of terms is straightforward: substituting into a pointer leaves it unchanged.
def subst (x : String) (s : Tm) (t : Tm) : Tm :=
match t with
-- pure STLC
| .var y =>
if x = y then s else t
| .abs y τ t₁ =>
if x = y then t else <{ λ y : τ . [x := s] t₁ }>
| .app t₁ t₂ =>
<{ ([x := s] t₁) ([x := s] t₂) }>
-- numbers
| .const _ =>
t
| .succ t₁ =>
<{ succ ([x := s] t₁) }>
| .pred t₁ =>
<{ pred ([x := s] t₁) }>
| .mult t₁ t₂ =>
<{ ([x := s] t₁) * ([x := s] t₂) }>
| .ite0 t₁ t₂ t₃ =>
<{
if0 [x := s] t₁
then [x := s] t₂
else [x := s] t₃
}>
-- unit
| .unit => <{ unit }>
-- references
| .ref t₁ => <{ ref ([x := s] t₁) }>
| .deref t₁ => <{ !([x := s] t₁) }>
| .loc n => .loc n
| .assign t₁ t₂ =>
<{ ([x := s] t₁) := ([x := s] t₂) }>
Notation encoding
open Lean PrettyPrinter in
@[app_unexpander subst]
def unexpandSubst : Unexpander := StlcCommon.Delab.unexpandSubst
9.2. Pragmatics
9.2.1. Side Effects and Sequencing
We can write (for example)
R := succ (!R); !R
as an abbreviation for
(λX:Unit. !R) (r := succ(!R)).
abbrev Tm.tseq (t₁ t₂ : Tm) : Tm :=
Tm.app (.abs "X" .unit t₂) t₁/-- info: <{ R := succ (!R) ; !R }> : Tm -/
#guard_msgs in
#check Tm.tseq <{R := succ (!R)}> <{!R}>
9.2.2. References and Aliasing
It is important to bear in mind the difference between the
reference that is bound to some variable r and the cell
in the store that is pointed to by this reference.
If we make a copy of r, for example by binding its value to
another variable s, what gets copied is only the reference,
not the contents of the cell itself.
For example, after reducing
let R = ref 5 in
let S = R in
S := 82;
(!R)+1
the cell referenced by R will contain the value 82, while the
result of the whole expression will be 83. The references R
and S are said to be aliases for the same cell.
The possibility of aliasing can make programs with references quite tricky to reason about. For example, the expression
R := 5; R := !S
assigns 5 to R and then immediately overwrites it with S's
current value; this has exactly the same effect as the single
assignment
R := !S
unless we happen to do it in a context where R and S are
aliases for the same cell!
let R = ref 0 in
let S = R in
R := 5; R := !S
9.2.3. Shared State
Of course, aliasing is also a large part of what makes references useful. In particular, it allows us to set up "implicit communication channels" — shared state — between different parts of a program. For example, suppose we define a reference cell and two functions that manipulate its contents:
let C = ref 0 in
let Incc = λ_:Unit. (C := succ (!C); !C) in
let Decc = λ_:Unit. (C := pred (!C); !C) in
...
The Unit-abstractions ("thunks") are used here to prevent
reduction until later.
9.2.4. Objects
We can go a step further and write a function that creates C,
Incc, and Decc, packages Incc and Decc together into a
record, and returns this record:
Newcounter =
λ_:Unit.
let C = ref 0 in
let Incc = λ_:Unit. (C := succ (!C); !C) in
let Decc = λ_:Unit. (C := pred (!C); !C) in
{i=Incc, d=Decc}
Now, each time we call Newcounter, we get a new record of
functions that share access to the same storage cell C. The
caller of Newcounter can't get at this storage cell directly,
but can affect it indirectly by calling the two functions. In
other words, we've created a simple form of object.
let C₁ = newcounter unit in let C₂ = newcounter unit in // we've allocated two separate storage cells now! let R₁ = C₁.i unit in let R₂ = C₂.i unit in R₂ // yields 1, not 2!
9.2.5. References to Compound Types
A reference cell need not contain just a number: the primitives we've defined above allow us to create references to values of any type, including functions. For example, we can use references to functions to give a(n inefficient) implementation of arrays of numbers as follows.
Write NatArray for the type Ref (Nat→Nat).
To build a new array, we allocate a reference cell and fill
it with a function that, when given an index, always returns 0.
Newarray = λ_:Unit. ref (λN:Nat.0)
To look up an element of an array, we apply the function to the desired index.
Lookup = λA:NatArray, λN:Nat. (!A) N
The interesting part of the encoding is the Update function. It
takes an array, an index, and a new value to be stored at that index, and
it does its job by creating (and storing in the reference) a new function
that, when it is asked for the value at this very index, returns the new
value that was given to Update, while on all other indices it passes the
lookup to the function that was previously stored in the reference.
Update = \A:NatArray, \M:Nat, \V:Nat, let Oldf = !A in A := (λN:Nat. if Equal M N then V else Oldf N);
References to values containing other references can also be very useful, allowing us to define data structures such as mutable lists and trees.
9.2.6. Null References
One more difference between our references and C-style mutable variables: null pointers.
-
In C, a pointer variable can contain either a valid pointer into the heap or the special value
NULL. -
A source of many errors and much tricky reasoning:
-
(any pointer may potentially be "not there")
-
but occasionally useful
-
-
Nullable pointers are easy to implement using references plus options (which can be built out of disjoint sum types):
Option τ = Unit + τ
NullableRef τ = Ref (Option τ)
9.2.7. Garbage Collection
A last issue that we should mention before we move on with formalizing references is storage de-allocation. We have not provided any primitives for freeing reference cells when they are no longer needed. Instead, like many modern languages (including OCaml, Haskell, Java, etc.), we rely on the run-time system to perform garbage collection, automatically identifying and reusing cells that can no longer be reached by the program.
This is not just a question of taste in language design: it is extremely difficult to achieve type safety in the presence of an explicit deallocation operation; only the Rust language has made this practical, at the cost of significantly constraining the creation and use of aliases.
One reason for this difficulty is the familiar dangling reference problem:
we allocate a cell holding a number, save a reference to it in
some data structure, use it for a while, then deallocate it and
allocate a new cell holding a boolean, possibly reusing the same
storage. Now we can have two names for the same storage cell —
one with type Ref Nat and the other with type Ref Bool.
9.3. Operational Semantics
9.3.1. Locations
A reference names a location in the store (a.k.a. heap).
What is the store?
-
Concretely: An array of 8-bit bytes, indexed by 32-bit integers.
-
More abstractly: a list or array of values
-
Even more abstractly: a partial function from locations to values.
We'll choose the middle way here: A store is a list of values, and a location is a natural-number index into this list.
9.3.2. Stores
A store is just a list of values. (This more concrete representation will be more convenient for proofs than the functional representation we used in Imp.) We will use the Greek letter ρ to represent stores.
abbrev Store := List Tm
We use ρ[n] to retrieve the value of the reference
cell at location n in the store ρ. Note that we must give a
default value to nth in case we try looking up an index which is
too large. (In fact, we never actually do this, but proving
that we don't will require a bit of work.)
open scoped MyGetElem
instance : MyGetElem Store Nat Tm where
getElem ρ n := ρ.getD n <{unit}>
@[simp]
theorem Store_get_succ_tl (hd : Tm) (tl : Store) (n : Nat) :
(hd :: tl)[n + 1] = tl[n] := hd:Tmtl:Storen:Nat⊢ (hd :: tl)[n + 1] = tl[n] All goals completed! 🐙
@[simp]
theorem Store_get_zero_hd (hd : Tm) (tl : Store) :
(hd :: tl)[0] = hd := hd:Tmtl:Store⊢ (hd :: tl)[0] = hd All goals completed! 🐙
To update the store, we use the List.set function, which replaces
the contents of a cell at a particular index.
def List.set : (l : List α) → (n : Nat) → (a : α) → List α
| cons _ as, 0, b => cons b as
| cons a as, Nat.succ n, b => cons a (set as n b)
| nil, _, _ => nil
As might be expected, we will also need some technical lemmas; they are straightforward to prove.
theorem Store_get_set_eq (ρ : Store) (l : Nat) (x : Tm)
(h : l < ρ.length) :
(ρ.set l x)[l] = x := ρ:Storel:Natx:Tmh:l < List.length ρ⊢ (List.set ρ l x)[l] = x
induction ρ generalizing l with
x:Tml:Nath:l < [].length⊢ ([].set l x)[l] = x All goals completed! 🐙
x:Tmhd:Tmtl:List Tmih:∀ (l : Nat), l < tl.length → (tl.set l x)[l] = xl:Nath:l < (hd :: tl).length⊢ ((hd :: tl).set l x)[l] = x x:Tmhd:Tmtl:List Tmih:∀ (l : Nat), l < tl.length → (tl.set l x)[l] = xh:0 < (hd :: tl).length⊢ ((hd :: tl).set 0 x)[0] = xx:Tmhd:Tmtl:List Tmih:∀ (l : Nat), l < tl.length → (tl.set l x)[l] = xn✝:Nath:n✝ + 1 < (hd :: tl).length⊢ ((hd :: tl).set (n✝ + 1) x)[n✝ + 1] = x x:Tmhd:Tmtl:List Tmih:∀ (l : Nat), l < tl.length → (tl.set l x)[l] = xh:0 < (hd :: tl).length⊢ ((hd :: tl).set 0 x)[0] = xx:Tmhd:Tmtl:List Tmih:∀ (l : Nat), l < tl.length → (tl.set l x)[l] = xn✝:Nath:n✝ + 1 < (hd :: tl).length⊢ ((hd :: tl).set (n✝ + 1) x)[n✝ + 1] = x All goals completed! 🐙
theorem Store_get_set_neq (l₁ l₂ : Nat) (t : Tm) (ρ : Store) :
l₁ ≠ l₂ ->
(ρ.set l₂ t)[l₁] = ρ[l₁] := l₁:Natl₂:Natt:Tmρ:Store⊢ l₁ ≠ l₂ → (List.set ρ l₂ t)[l₁] = ρ[l₁]
induction ρ generalizing l₁ l₂ with
t:Tml₁:Natl₂:Nat⊢ l₁ ≠ l₂ → ([].set l₂ t)[l₁] = [][l₁] All goals completed! 🐙
t:Tmhd:Tmtl:List Tmih:∀ (l₁ l₂ : Nat), l₁ ≠ l₂ → (tl.set l₂ t)[l₁] = tl[l₁]l₁:Natl₂:Nat⊢ l₁ ≠ l₂ → ((hd :: tl).set l₂ t)[l₁] = (hd :: tl)[l₁] t:Tmhd:Tmtl:List Tmih:∀ (l₁ l₂ : Nat), l₁ ≠ l₂ → (tl.set l₂ t)[l₁] = tl[l₁]l₂:Nat⊢ 0 ≠ l₂ → ((hd :: tl).set l₂ t)[0] = (hd :: tl)[0]t:Tmhd:Tmtl:List Tmih:∀ (l₁ l₂ : Nat), l₁ ≠ l₂ → (tl.set l₂ t)[l₁] = tl[l₁]l₂:Natn✝:Nat⊢ n✝ + 1 ≠ l₂ → ((hd :: tl).set l₂ t)[n✝ + 1] = (hd :: tl)[n✝ + 1] t:Tmhd:Tmtl:List Tmih:∀ (l₁ l₂ : Nat), l₁ ≠ l₂ → (tl.set l₂ t)[l₁] = tl[l₁]l₂:Nat⊢ 0 ≠ l₂ → ((hd :: tl).set l₂ t)[0] = (hd :: tl)[0]t:Tmhd:Tmtl:List Tmih:∀ (l₁ l₂ : Nat), l₁ ≠ l₂ → (tl.set l₂ t)[l₁] = tl[l₁]l₂:Natn✝:Nat⊢ n✝ + 1 ≠ l₂ → ((hd :: tl).set l₂ t)[n✝ + 1] = (hd :: tl)[n✝ + 1] t:Tmhd:Tmtl:List Tmih:∀ (l₁ l₂ : Nat), l₁ ≠ l₂ → (tl.set l₂ t)[l₁] = tl[l₁]n✝:Nat⊢ n✝ + 1 ≠ 0 → ((hd :: tl).set 0 t)[n✝ + 1] = (hd :: tl)[n✝ + 1]t:Tmhd:Tmtl:List Tmih:∀ (l₁ l₂ : Nat), l₁ ≠ l₂ → (tl.set l₂ t)[l₁] = tl[l₁]n✝¹:Natn✝:Nat⊢ n✝¹ + 1 ≠ n✝ + 1 → ((hd :: tl).set (n✝ + 1) t)[n✝¹ + 1] = (hd :: tl)[n✝¹ + 1] t:Tmhd:Tmtl:List Tmih:∀ (l₁ l₂ : Nat), l₁ ≠ l₂ → (tl.set l₂ t)[l₁] = tl[l₁]⊢ 0 ≠ 0 → ((hd :: tl).set 0 t)[0] = (hd :: tl)[0]t:Tmhd:Tmtl:List Tmih:∀ (l₁ l₂ : Nat), l₁ ≠ l₂ → (tl.set l₂ t)[l₁] = tl[l₁]n✝:Nat⊢ 0 ≠ n✝ + 1 → ((hd :: tl).set (n✝ + 1) t)[0] = (hd :: tl)[0]t:Tmhd:Tmtl:List Tmih:∀ (l₁ l₂ : Nat), l₁ ≠ l₂ → (tl.set l₂ t)[l₁] = tl[l₁]n✝:Nat⊢ n✝ + 1 ≠ 0 → ((hd :: tl).set 0 t)[n✝ + 1] = (hd :: tl)[n✝ + 1]t:Tmhd:Tmtl:List Tmih:∀ (l₁ l₂ : Nat), l₁ ≠ l₂ → (tl.set l₂ t)[l₁] = tl[l₁]n✝¹:Natn✝:Nat⊢ n✝¹ + 1 ≠ n✝ + 1 → ((hd :: tl).set (n✝ + 1) t)[n✝¹ + 1] = (hd :: tl)[n✝¹ + 1] All goals completed! 🐙
9.3.3. Reduction
First, we augment existing reduction rules with stores:
v₂.IsValue
------------------------------------ (appAbs)
(λx:τ₂. t₁) v₂ / ρ ⟶ [x:=v₂] t₁ / ρ
t₁ / ρ ⟶ t₁' / ρ'
--------------------------------- (app₁)
t₁ t₂ / ρ ⟶ t₁' t₂ / ρ'
v₁.IsValue
t₂ / ρ ⟶ t₂' / ρ'
--------------------------------- (app₂)
v₁ t₂ / ρ ⟶ v₁ t₂' / ρ'
Now we can give the rules for the new constructs:
------------------------------------ (refValue)
ref v / ρ ⟶ loc ρ.length / ρ,v
t₁ / ρ ⟶ t₁' / ρ'
------------------------------ (ref)
ref t₁ / ρ ⟶ ref t₁' / ρ'
l < ρ.length
-------------------------- (derefLoc)
!(loc l) / ρ ⟶ ρ[l] / ρ
t₁ / ρ ⟶ t₁' / ρ'
--------------------------- (deref)
!t₁ / ρ ⟶ !t₁' / ρ'
l < ρ.length
--------------------------------------- (assign)
loc l := v / ρ ⟶ unit / List.set ρ l v
t₁ / ρ ⟶ t₁' / ρ'
-------------------------------- (assign₁)
t₁ := t₂ / ρ ⟶ t₁' := t₂ / ρ'
t₂ / ρ ⟶ t₂' / ρ'
-------------------------------- (assign₂)
v₁ := t₂ / ρ ⟶ v₁ := t₂' / ρ'
Notation
section
set_option hygiene false in
local notation:40
t:71 " / " ρ:41 " ⟶ " t':71 " / " ρ':41 =>
Step (t, ρ) (t', ρ')
inductive Step : Tm × Store → Tm × Store → Prop where
-- pure STLC
| appAbs {x : String} {τ₂ : Ty} {t₁ v₂ : Tm} {ρ : Store}
(h : v₂.IsValue) :
<{(λ x : τ₂ . t₁) v₂}> / ρ ⟶
<{ [x := v₂] t₁ }> / ρ
| app₁ {t₁ t₁' t₂ : Tm} {ρ ρ' : Store}
(h : t₁ / ρ ⟶ t₁' / ρ') :
<{t₁ t₂}> / ρ ⟶ <{t₁' t₂}> / ρ'
| app₂ {v₁ t₂ t₂' : Tm} {ρ ρ' : Store}
(h₁ : v₁.IsValue)
(h₂ : t₂ / ρ ⟶ t₂' / ρ') :
<{v₁ t₂}> / ρ ⟶ <{v₁ t₂'}> / ρ'
-- numbers
| succNat {n : Nat} {ρ : Store} :
<{ succ ~(Tm.const n) }> / ρ ⟶ Tm.const (n + 1) / ρ
| succ {t₁ t₁' : Tm} {ρ ρ' : Store}
(h : t₁ / ρ ⟶ t₁' / ρ') :
<{ succ t₁ }> / ρ ⟶ <{ succ t₁' }> / ρ'
| predConst {n : Nat} {ρ : Store} :
<{ pred ~(Tm.const n) }> / ρ ⟶ Tm.const (n - 1) / ρ
| pred {t₁ t₁' : Tm} {ρ ρ' : Store}
(h : t₁ / ρ ⟶ t₁' / ρ') :
<{ pred t₁ }> / ρ ⟶ <{ pred t₁' }> / ρ'
| multConst {n₁ n₂ : Nat} {ρ : Store} :
<{ ~(Tm.const n₁) * ~(Tm.const n₂) }> / ρ ⟶
Tm.const (n₁ * n₂) / ρ
| mult₁ {t₁ t₁' t₂ : Tm} {ρ ρ' : Store}
(h : t₁ / ρ ⟶ t₁' / ρ') :
<{ t₁ * t₂ }> / ρ ⟶ <{ t₁' * t₂ }> / ρ'
| mult₂ {v₁ t₂ t₂' : Tm} {ρ ρ' : Store}
(h₁ : v₁.IsValue)
(h₂ : t₂ / ρ ⟶ t₂' / ρ') :
<{ v₁ * t₂ }> / ρ ⟶ <{ v₁ * t₂' }> / ρ'
| if0Step {t₁ t₁' t₂ t₃ : Tm} {ρ ρ' : Store}
(h : t₁ / ρ ⟶ t₁' / ρ') :
<{ if0 t₁ then t₂ else t₃ }> / ρ ⟶
<{ if0 t₁' then t₂ else t₃ }> / ρ'
| if0Zero {t₂ t₃ : Tm} {ρ : Store} :
<{ if0 0 then t₂ else t₃ }> / ρ ⟶ t₂ / ρ
| if0Nonzero {n : Nat} {t₂ t₃ : Tm} {ρ : Store} :
<{ if0 ~(Tm.const (n + 1)) then t₂ else t₃ }> / ρ ⟶
t₃ / ρ
-- references
| refValue {v : Tm} {ρ : Store}
(h : v.IsValue) :
<{ ref v }> / ρ ⟶ Tm.loc ρ.length / ρ.concat v
| ref_ {t₁ t₁' : Tm} {ρ ρ' : Store}
(h : t₁ / ρ ⟶ t₁' / ρ') :
<{ ref t₁ }> / ρ ⟶ <{ ref t₁' }> / ρ'
| derefLoc {l : Nat} {ρ : Store}
(h : l < ρ.length) :
<{ !~(Tm.loc l) }> / ρ ⟶ ρ[l] / ρ
| deref {t₁ t₁' : Tm} {ρ ρ' : Store}
(h : t₁ / ρ ⟶ t₁' / ρ') :
<{ !t₁ }> / ρ ⟶ <{ !t₁' }> / ρ'
| assign {v : Tm} {l : Nat} {ρ : Store}
(h₁ : v.IsValue)
(h₂ : l < ρ.length) :
<{ ~(Tm.loc l) := v }> / ρ ⟶ <{ unit }> / ρ.set l v
| assign₁ {t₁ t₁' t₂ : Tm} {ρ ρ' : Store}
(h : t₁ / ρ ⟶ t₁' / ρ') :
<{ t₁ := t₂ }> / ρ ⟶ <{ t₁' := t₂ }> / ρ'
| assign₂ {v₁ t₂ t₂' : Tm} {ρ ρ' : Store}
(h₁ : v₁.IsValue)
(h₂ : t₂ / ρ ⟶ t₂' / ρ') :
<{ v₁ := t₂ }> / ρ ⟶ <{ v₁ := t₂' }> / ρ'
end
attribute [StlcRefEval] Step.appAbs Step.app₁ Step.app₂
Step.succ Step.succNat Step.pred Step.predConst
Step.multConst Step.mult₁ Step.mult₂
Step.if0Step Step.if0Zero Step.if0Nonzero
Step.refValue Step.ref_ Step.derefLoc Step.deref Step.assign
Step.assign₁ Step.assign₂
9.4. Typing
The contexts assigning types to free variables are exactly the same as for the STLC: partial maps from identifiers to types.
abbrev Context := PartialMap String Ty
9.4.1. Store typings
Naturally, the key question is, "What is the type of a location?"
As a first try, observe that the type of a location is connected to the contents of the store ρ.
Γ ⊢ ρ[l] : τ₁
------------------
Γ ⊢ loc l : Ref τ₁
But where does ρ come from?
We could try adding ρ to the judgment: Γ; ρ ⊢ t : τ, which gives us this rule:
Γ; ρ ⊢ ρ[l] : τ₁
---------------------
Γ; ρ ⊢ loc l : Ref τ₁
But that means the whole store ρ, including all dynamically
created values, is needed during typechecking. This does not seem
like something we want.
Worse yet, it doesn't work at all for cyclic stores.
For example, what is the type of location 0 in the following store?
λX:Nat. (!(loc 1)) X, λX:Nat. (!(loc 0)) X
Instead, we establish an invariant that the type of value stored in a location never changes.
This static representation of the store contents is called a store typing:
abbrev StoreTy := List Ty
Here we represent locations as indices into a list of
types so the type at index i is the type of the values stored in
cell i.
open scoped MyGetElem
instance : MyGetElem StoreTy Nat Ty where
getElem δ n := δ.getD n <{Unit}>
@[simp]
theorem StoreTy_get_succ_tl (hd : Ty) (tl : StoreTy) (n : Nat) :
(hd :: tl)[n + 1] = tl[n] := hd:Tytl:StoreTyn:Nat⊢ (hd :: tl)[n + 1] = tl[n] All goals completed! 🐙
@[simp]
theorem StoreTy_get_zero_hd (hd : Ty) (tl : StoreTy) :
(hd :: tl)[0] = hd := hd:Tytl:StoreTy⊢ (hd :: tl)[0] = hd All goals completed! 🐙
We can use the store typing δ to give a type to
any location l like this:
l < δ.length
-----------------------
Γ; δ ⊢ loc l : Ref δ[l]
That is, as long as l is a valid location, we can compute the
type of l just by looking it up in δ. Typing is again a
four-place relation, but it is parameterized on a store typing
rather than a concrete store. The rest of the typing rules are
analogously augmented with store typings.
9.4.2. The Typing Relation
l < δ.length
----------------------- (loc)
Γ; δ ⊢ loc l : Ref δ[l]
Γ; δ ⊢ t₁ : τ₁
---------------------- (ref)
Γ; δ ⊢ ref t₁ : Ref τ₁
Γ; δ ⊢ t₁ : Ref τ₁
------------------ (deref)
Γ; δ ⊢ !t₁ : τ₁
Γ; δ ⊢ t₁ : Ref τ₂
Γ; δ ⊢ t₂ : τ₂
---------------------- (assign)
Γ; δ ⊢ t₁ := t₂ : Unit
inductive HasType (δ : StoreTy) : Context → Tm → Ty → Prop where
-- pure STLC
| var {Γ : Context} {x : String} {τ₁ : Ty}
(h : Γ[x] = some τ₁) :
<{ Γ / δ ⊢ ~(Tm.var x) ⦂ τ₁ }>
| abs {Γ : Context} {x : String} {τ₁ τ₂ : Ty} {t₁ : Tm}
(h : <{ x ↦ τ₂ ; Γ / δ ⊢ t₁ ⦂ τ₁ }>) :
<{ Γ / δ ⊢ λ x : τ₂ . t₁ ⦂ τ₂ → τ₁ }>
| app {Γ : Context} {τ₁ τ₂ : Ty} {t₁ t₂ : Tm}
(h₁ : <{ Γ / δ ⊢ t₁ ⦂ τ₂ → τ₁ }>)
(h₂ : <{ Γ / δ ⊢ t₂ ⦂ τ₂ }>) :
<{ Γ / δ ⊢ t₁ t₂ ⦂ τ₁ }>
-- numbers
| const {Γ : Context} {n : Nat} :
<{ Γ / δ ⊢ ~(Tm.const n) ⦂ Nat }>
| succ {Γ : Context} {t₁ : Tm}
(h : <{ Γ / δ ⊢ t₁ ⦂ Nat }>) :
<{ Γ / δ ⊢ succ t₁ ⦂ Nat }>
| pred {Γ : Context} {t₁ : Tm}
(h : <{ Γ / δ ⊢ t₁ ⦂ Nat }>) :
<{ Γ / δ ⊢ pred t₁ ⦂ Nat }>
| mult {Γ : Context} {t₁ t₂ : Tm}
(h₁ : <{ Γ / δ ⊢ t₁ ⦂ Nat }>)
(h₂ : <{ Γ / δ ⊢ t₂ ⦂ Nat }>) :
<{ Γ / δ ⊢ t₁ * t₂ ⦂ Nat }>
| ite0 {Γ : Context} {t₁ t₂ t₃ : Tm} {τ : Ty}
(h₁ : <{ Γ / δ ⊢ t₁ ⦂ Nat }>)
(h₂ : <{ Γ / δ ⊢ t₂ ⦂ τ }>)
(h₃ : <{ Γ / δ ⊢ t₃ ⦂ τ }>) :
<{ Γ / δ ⊢ if0 t₁ then t₂ else t₃ ⦂ τ }>
-- unit
| unit {Γ : Context} :
<{ Γ / δ ⊢ unit ⦂ Unit }>
-- references
| loc_ {Γ : Context} {l : Nat}
(h : l < δ.length) :
<{ Γ / δ ⊢ ~(Tm.loc l) ⦂ Ref ~(δ[l]) }>
| ref_ {Γ : Context} {t₁ : Tm} {τ₁ : Ty}
(h : <{ Γ / δ ⊢ t₁ ⦂ τ₁ }>) :
<{ Γ / δ ⊢ ref t₁ ⦂ Ref τ₁ }>
| deref {Γ : Context} {t₁ : Tm} {τ₁ : Ty}
(h : <{ Γ / δ ⊢ t₁ ⦂ Ref τ₁ }>) :
<{ Γ / δ ⊢ !t₁ ⦂ τ₁ }>
| assign {Γ : Context} {t₁ t₂ : Tm} {τ₂ : Ty}
(h₁ : <{ Γ / δ ⊢ t₁ ⦂ Ref τ₂ }>)
(h₂ : <{ Γ / δ ⊢ t₂ ⦂ τ₂ }>) :
<{ Γ / δ ⊢ t₁ := t₂ ⦂ Unit }>
attribute [StlcRefTyping] HasType.var HasType.abs HasType.app
HasType.const HasType.succ HasType.pred HasType.mult
HasType.ite0 HasType.unit
HasType.loc_ HasType.ref_ HasType.deref HasType.assign
Notation encoding
open Lean PrettyPrinter StlcCommon.Delab in
@[app_unexpander HasType]
def HasType.unexpand : Unexpander
| `($_ $δ $Γ $t $T) => do
let Γ' ← unexpandCtx Γ
`(<{ $Γ':stlcCtx / $δ ⊢ $(getTm t):stlcTm ⦂ $(getTy T):stlcTy }>)
| _ => throw ()
9.5. Properties
Standard theorems...
-
Progress — pretty much same as always
-
Preservation — needs to be stated more carefully!
9.5.1. Well-Typed Stores
The evaluation and typing relations take more parameters now, but nothing yet relates them...
theorem progress_wrong (δ : StoreTy) (t : Tm) (τ : Ty) (ρ : Store)
(hTy : <{ ∅ / δ ⊢ t ⦂ τ }>) :
(t.IsValue ∨ ∃ t' ρ', t / ρ ⟶ t' / ρ') := by
Obviously wrong: no relation between assumed store typing and provided store!
We need a way of saying "this store satisfies the assumptions of that store typing"...
def StoreWellTyped (δ:StoreTy) (ρ:Store) :=
δ.length = ρ.length ∧
(∀ (l : Nat), l < ρ.length → <{ ∅ / δ ⊢ ~(ρ[l]) ⦂ ~(δ[l]) }>)
Informally, we will write δ ⊢ ρ for StoreWellTyped δ ρ.
scoped notation:40 δ:41 " ⊢ " ρ:41 => StoreWellTyped δ ρ
Intuitively, a store ρ is consistent with a store typing
δ if every value in the store has the type predicted by the
store typing. The only subtle point is the fact that, when typing
the values in the store, we supply the very same store typing to
the typing relation. This allows us to type circular stores like
the one we saw above.
9.5.2. Progress
The Progress proof is very similar to the one for the STLC,
with a few new cases for the new syntactic constructs. The
deref and assign cases are where hStoreTy comes in.
theorem progress (δ : StoreTy) (t : Tm) (τ : Ty) (ρ : Store)
(hTy : <{ ∅ / δ ⊢ t ⦂ τ }>)
(hStoreTy : δ ⊢ ρ) :
(t.IsValue ∨ ∃ t' ρ', t / ρ ⟶ t' / ρ') := δ:StoreTyt:Tmτ:Tyρ:StorehTy:<{ ∅ / δ ⊢ t ⦂ τ }>hStoreTy:δ ⊢ ρ⊢ t.IsValue ∨ ∃ t' ρ', t / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehTy:<{ ∅ / δ ⊢ t ⦂ τ }>hStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>⊢ t.IsValue ∨ ∃ t' ρ', t / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextheq:∅ = ΓhTy:<{ Γ / δ ⊢ t ⦂ τ }>⊢ t.IsValue ∨ ∃ t' ρ', t / ρ ⟶ t' / ρ'
induction hTy with (δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextl✝:Nath✝:l✝ < List.length δ⊢ (Tm.loc l✝).IsValue ∨ ∃ t' ρ', Tm.loc l✝ / ρ ⟶ t' / ρ'; first
| δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextl✝:Nath✝:l✝ < List.length δ⊢ (Tm.loc l✝).IsValue ∨ ∃ t' ρ', Tm.loc l✝ / ρ ⟶ t' / ρ'
-- discharge cases where `t` is obviously a value
| try (δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextl✝:Nath✝:l✝ < List.length δ⊢ (Tm.loc l✝).IsValue; All goals completed! 🐙; done))
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'⊢ <{ t₁✝ t₂✝ }>.IsValue ∨ ∃ t' ρ', <{ t₁✝ t₂✝ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ t₁✝ t₂✝ }> / ρ ⟶ t' / ρ'; cases ih₁ (δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'⊢ ∅ = ∅ All goals completed! 🐙) with
-- t₁ is a value
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValue⊢ ∃ t' ρ', <{ t₁✝ t₂✝ }> / ρ ⟶ t' / ρ'
cases ih₂ (δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValue⊢ ∅ = ∅ All goals completed! 🐙) with
-- t₂ is a value
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValuehv₂:t₂✝.IsValue⊢ ∃ t' ρ', <{ t₁✝ t₂✝ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝¹:Tyt₂✝:Tmh₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₂:t₂✝.IsValuex✝:Stringτ₂✝:Tyt₁✝:Tmh₁:<{ ∅ / δ ⊢ λ ~x✝ : τ₂✝ . t₁✝ ⦂ τ₂✝¹ → τ₁✝ }>ih₁:∅ = ∅ → <{ λ ~x✝ : τ₂✝ . t₁✝ }>.IsValue ∨ ∃ t' ρ', <{ λ ~x✝ : τ₂✝ . t₁✝ }> / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ (λ ~x✝ : τ₂✝ . t₁✝) t₂✝ }> / ρ ⟶ t' / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝:Tyt₂✝:Tmh₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₂:t₂✝.IsValuen✝:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ τ₂✝ → τ₁✝ }>ih₁:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ ~(Tm.const n✝) t₂✝ }> / ρ ⟶ t' / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝:Tyt₂✝:Tmh₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₂:t₂✝.IsValueh₁:<{ ∅ / δ ⊢ unit ⦂ τ₂✝ → τ₁✝ }>ih₁:∅ = ∅ → <{ unit }>.IsValue ∨ ∃ t' ρ', <{ unit }> / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ unit t₂✝ }> / ρ ⟶ t' / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝:Tyt₂✝:Tmh₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₂:t₂✝.IsValuel✝:Nath₁:<{ ∅ / δ ⊢ ~(Tm.loc l✝) ⦂ τ₂✝ → τ₁✝ }>ih₁:∅ = ∅ → (Tm.loc l✝).IsValue ∨ ∃ t' ρ', Tm.loc l✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ ~(Tm.loc l✝) t₂✝ }> / ρ ⟶ t' / ρ' δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝¹:Tyt₂✝:Tmh₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₂:t₂✝.IsValuex✝:Stringτ₂✝:Tyt₁✝:Tmh₁:<{ ∅ / δ ⊢ λ ~x✝ : τ₂✝ . t₁✝ ⦂ τ₂✝¹ → τ₁✝ }>ih₁:∅ = ∅ → <{ λ ~x✝ : τ₂✝ . t₁✝ }>.IsValue ∨ ∃ t' ρ', <{ λ ~x✝ : τ₂✝ . t₁✝ }> / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ (λ ~x✝ : τ₂✝ . t₁✝) t₂✝ }> / ρ ⟶ t' / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝:Tyt₂✝:Tmh₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₂:t₂✝.IsValuen✝:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ τ₂✝ → τ₁✝ }>ih₁:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ ~(Tm.const n✝) t₂✝ }> / ρ ⟶ t' / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝:Tyt₂✝:Tmh₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₂:t₂✝.IsValueh₁:<{ ∅ / δ ⊢ unit ⦂ τ₂✝ → τ₁✝ }>ih₁:∅ = ∅ → <{ unit }>.IsValue ∨ ∃ t' ρ', <{ unit }> / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ unit t₂✝ }> / ρ ⟶ t' / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝:Tyt₂✝:Tmh₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₂:t₂✝.IsValuel✝:Nath₁:<{ ∅ / δ ⊢ ~(Tm.loc l✝) ⦂ τ₂✝ → τ₁✝ }>ih₁:∅ = ∅ → (Tm.loc l✝).IsValue ∨ ∃ t' ρ', Tm.loc l✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ ~(Tm.loc l✝) t₂✝ }> / ρ ⟶ t' / ρ' try All goals completed! 🐙
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝¹:Tyt₂✝:Tmh₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₂:t₂✝.IsValuex✝:Stringτ₂✝:Tyt₁✝:Tmh₁:<{ ∅ / δ ⊢ λ ~x✝ : τ₂✝ . t₁✝ ⦂ τ₂✝¹ → τ₁✝ }>ih₁:∅ = ∅ → <{ λ ~x✝ : τ₂✝ . t₁✝ }>.IsValue ∨ ∃ t' ρ', <{ λ ~x✝ : τ₂✝ . t₁✝ }> / ρ ⟶ t' / ρ'⊢ ∃ ρ', <{ (λ ~x✝ : τ₂✝ . t₁✝) t₂✝ }> / ρ ⟶ ?app.inl.inl.abs.w / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝¹:Tyt₂✝:Tmh₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₂:t₂✝.IsValuex✝:Stringτ₂✝:Tyt₁✝:Tmh₁:<{ ∅ / δ ⊢ λ ~x✝ : τ₂✝ . t₁✝ ⦂ τ₂✝¹ → τ₁✝ }>ih₁:∅ = ∅ → <{ λ ~x✝ : τ₂✝ . t₁✝ }>.IsValue ∨ ∃ t' ρ', <{ λ ~x✝ : τ₂✝ . t₁✝ }> / ρ ⟶ t' / ρ'⊢ Tm; δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝¹:Tyt₂✝:Tmh₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₂:t₂✝.IsValuex✝:Stringτ₂✝:Tyt₁✝:Tmh₁:<{ ∅ / δ ⊢ λ ~x✝ : τ₂✝ . t₁✝ ⦂ τ₂✝¹ → τ₁✝ }>ih₁:∅ = ∅ → <{ λ ~x✝ : τ₂✝ . t₁✝ }>.IsValue ∨ ∃ t' ρ', <{ λ ~x✝ : τ₂✝ . t₁✝ }> / ρ ⟶ t' / ρ'⊢ <{ (λ ~x✝ : τ₂✝ . t₁✝) t₂✝ }> / ρ ⟶ ?app.inl.inl.abs.w / ?app.inl.inl.abs.h.wδ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝¹:Tyt₂✝:Tmh₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₂:t₂✝.IsValuex✝:Stringτ₂✝:Tyt₁✝:Tmh₁:<{ ∅ / δ ⊢ λ ~x✝ : τ₂✝ . t₁✝ ⦂ τ₂✝¹ → τ₁✝ }>ih₁:∅ = ∅ → <{ λ ~x✝ : τ₂✝ . t₁✝ }>.IsValue ∨ ∃ t' ρ', <{ λ ~x✝ : τ₂✝ . t₁✝ }> / ρ ⟶ t' / ρ'⊢ Storeδ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝¹:Tyt₂✝:Tmh₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₂:t₂✝.IsValuex✝:Stringτ₂✝:Tyt₁✝:Tmh₁:<{ ∅ / δ ⊢ λ ~x✝ : τ₂✝ . t₁✝ ⦂ τ₂✝¹ → τ₁✝ }>ih₁:∅ = ∅ → <{ λ ~x✝ : τ₂✝ . t₁✝ }>.IsValue ∨ ∃ t' ρ', <{ λ ~x✝ : τ₂✝ . t₁✝ }> / ρ ⟶ t' / ρ'⊢ Tm; All goals completed! 🐙
-- t₂ steps
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValuehs₂:∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ t₁✝ t₂✝ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValuehs₂✝:∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ't₂':Tmρ':Storehs₂:t₂✝ / ρ ⟶ t₂' / ρ'⊢ ∃ t' ρ', <{ t₁✝ t₂✝ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValuehs₂✝:∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ't₂':Tmρ':Storehs₂:t₂✝ / ρ ⟶ t₂' / ρ'⊢ ∃ ρ', <{ t₁✝ t₂✝ }> / ρ ⟶ ?app.inl.inr.w / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValuehs₂✝:∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ't₂':Tmρ':Storehs₂:t₂✝ / ρ ⟶ t₂' / ρ'⊢ Tm; δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValuehs₂✝:∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ't₂':Tmρ':Storehs₂:t₂✝ / ρ ⟶ t₂' / ρ'⊢ <{ t₁✝ t₂✝ }> / ρ ⟶ ?app.inl.inr.w / ?app.inl.inr.h.wδ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValuehs₂✝:∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ't₂':Tmρ':Storehs₂:t₂✝ / ρ ⟶ t₂' / ρ'⊢ Storeδ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValuehs₂✝:∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ't₂':Tmρ':Storehs₂:t₂✝ / ρ ⟶ t₂' / ρ'⊢ Tm; All goals completed! 🐙
-- t₁ steps
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hs₁:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ t₁✝ t₂✝ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hs₁✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs₁:t₁✝ / ρ ⟶ t₁' / ρ'⊢ ∃ t' ρ', <{ t₁✝ t₂✝ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hs₁✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs₁:t₁✝ / ρ ⟶ t₁' / ρ'⊢ ∃ ρ', <{ t₁✝ t₂✝ }> / ρ ⟶ ?app.inr.w / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hs₁✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs₁:t₁✝ / ρ ⟶ t₁' / ρ'⊢ Tm; δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hs₁✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs₁:t₁✝ / ρ ⟶ t₁' / ρ'⊢ <{ t₁✝ t₂✝ }> / ρ ⟶ ?app.inr.w / ?app.inr.h.wδ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hs₁✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs₁:t₁✝ / ρ ⟶ t₁' / ρ'⊢ Storeδ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hs₁✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs₁:t₁✝ / ρ ⟶ t₁' / ρ'⊢ Tm; All goals completed! 🐙
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmh:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'⊢ <{ succ t₁✝ }>.IsValue ∨ ∃ t' ρ', <{ succ t₁✝ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmh:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'⊢ <{ pred t₁✝ }>.IsValue ∨ ∃ t' ρ', <{ pred t₁✝ }> / ρ ⟶ t' / ρ' δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmh:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'⊢ <{ pred t₁✝ }>.IsValue ∨ ∃ t' ρ', <{ pred t₁✝ }> / ρ ⟶ t' / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmh:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'⊢ <{ succ t₁✝ }>.IsValue ∨ ∃ t' ρ', <{ succ t₁✝ }> / ρ ⟶ t' / ρ'
-- these two cases are the same
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmh:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ pred t₁✝ }> / ρ ⟶ t' / ρ'; cases ih (δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmh:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'⊢ ∅ = ∅ All goals completed! 🐙) with
-- t₁ is a value
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmh:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hv:t₁✝.IsValue⊢ ∃ t' ρ', <{ pred t₁✝ }> / ρ ⟶ t' / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmh:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hv:t₁✝.IsValue⊢ ∃ t' ρ', <{ succ t₁✝ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextx✝:Stringτ₂✝:Tyt₁✝:Tmh:<{ ∅ / δ ⊢ λ ~x✝ : τ₂✝ . t₁✝ ⦂ Nat }>ih:∅ = ∅ → <{ λ ~x✝ : τ₂✝ . t₁✝ }>.IsValue ∨ ∃ t' ρ', <{ λ ~x✝ : τ₂✝ . t₁✝ }> / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ pred (λ ~x✝ : τ₂✝ . t₁✝) }> / ρ ⟶ t' / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextn✝:Nath:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ pred ~(Tm.const n✝) }> / ρ ⟶ t' / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contexth:<{ ∅ / δ ⊢ unit ⦂ Nat }>ih:∅ = ∅ → <{ unit }>.IsValue ∨ ∃ t' ρ', <{ unit }> / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ pred unit }> / ρ ⟶ t' / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextl✝:Nath:<{ ∅ / δ ⊢ ~(Tm.loc l✝) ⦂ Nat }>ih:∅ = ∅ → (Tm.loc l✝).IsValue ∨ ∃ t' ρ', Tm.loc l✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ pred ~(Tm.loc l✝) }> / ρ ⟶ t' / ρ' δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextx✝:Stringτ₂✝:Tyt₁✝:Tmh:<{ ∅ / δ ⊢ λ ~x✝ : τ₂✝ . t₁✝ ⦂ Nat }>ih:∅ = ∅ → <{ λ ~x✝ : τ₂✝ . t₁✝ }>.IsValue ∨ ∃ t' ρ', <{ λ ~x✝ : τ₂✝ . t₁✝ }> / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ pred (λ ~x✝ : τ₂✝ . t₁✝) }> / ρ ⟶ t' / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextn✝:Nath:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ pred ~(Tm.const n✝) }> / ρ ⟶ t' / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contexth:<{ ∅ / δ ⊢ unit ⦂ Nat }>ih:∅ = ∅ → <{ unit }>.IsValue ∨ ∃ t' ρ', <{ unit }> / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ pred unit }> / ρ ⟶ t' / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextl✝:Nath:<{ ∅ / δ ⊢ ~(Tm.loc l✝) ⦂ Nat }>ih:∅ = ∅ → (Tm.loc l✝).IsValue ∨ ∃ t' ρ', Tm.loc l✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ pred ~(Tm.loc l✝) }> / ρ ⟶ t' / ρ' try All goals completed! 🐙
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextn✝:Nath:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'⊢ ∃ ρ', <{ pred ~(Tm.const n✝) }> / ρ ⟶ ?pred.inl.nat.w / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextn✝:Nath:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'⊢ Tm; δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextn✝:Nath:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'⊢ <{ pred ~(Tm.const n✝) }> / ρ ⟶ ?pred.inl.nat.w / ?pred.inl.nat.h.wδ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextn✝:Nath:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'⊢ Storeδ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextn✝:Nath:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'⊢ Tm; All goals completed! 🐙
-- t₁ steps
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmh:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hs:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ pred t₁✝ }> / ρ ⟶ t' / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmh:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hs:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ succ t₁✝ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmh:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hs✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs:t₁✝ / ρ ⟶ t₁' / ρ'⊢ ∃ t' ρ', <{ pred t₁✝ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmh:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hs✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs:t₁✝ / ρ ⟶ t₁' / ρ'⊢ ∃ ρ', <{ pred t₁✝ }> / ρ ⟶ ?pred.inr.w / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmh:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hs✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs:t₁✝ / ρ ⟶ t₁' / ρ'⊢ Tm; δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmh:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hs✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs:t₁✝ / ρ ⟶ t₁' / ρ'⊢ <{ pred t₁✝ }> / ρ ⟶ ?pred.inr.w / ?pred.inr.h.wδ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmh:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hs✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs:t₁✝ / ρ ⟶ t₁' / ρ'⊢ Storeδ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmh:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hs✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs:t₁✝ / ρ ⟶ t₁' / ρ'⊢ Tm; All goals completed! 🐙
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'⊢ <{ t₁✝ * t₂✝ }>.IsValue ∨ ∃ t' ρ', <{ t₁✝ * t₂✝ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ t₁✝ * t₂✝ }> / ρ ⟶ t' / ρ'; cases ih₁ (δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'⊢ ∅ = ∅ All goals completed! 🐙) with
-- t₁ is a value
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValue⊢ ∃ t' ρ', <{ t₁✝ * t₂✝ }> / ρ ⟶ t' / ρ'
cases ih₂ (δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValue⊢ ∅ = ∅ All goals completed! 🐙) with
-- t₂ is a value
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValuehv₂:t₂✝.IsValue⊢ ∃ t' ρ', <{ t₁✝ * t₂✝ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₂✝:Tmh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₂:t₂✝.IsValuex✝:Stringτ₂✝:Tyt₁✝:Tmh₁:<{ ∅ / δ ⊢ λ ~x✝ : τ₂✝ . t₁✝ ⦂ Nat }>ih₁:∅ = ∅ → <{ λ ~x✝ : τ₂✝ . t₁✝ }>.IsValue ∨ ∃ t' ρ', <{ λ ~x✝ : τ₂✝ . t₁✝ }> / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ (λ ~x✝ : τ₂✝ . t₁✝) * t₂✝ }> / ρ ⟶ t' / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₂✝:Tmh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₂:t₂✝.IsValuen✝:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih₁:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ ~(Tm.const n✝) * t₂✝ }> / ρ ⟶ t' / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₂✝:Tmh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₂:t₂✝.IsValueh₁:<{ ∅ / δ ⊢ unit ⦂ Nat }>ih₁:∅ = ∅ → <{ unit }>.IsValue ∨ ∃ t' ρ', <{ unit }> / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ unit * t₂✝ }> / ρ ⟶ t' / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₂✝:Tmh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₂:t₂✝.IsValuel✝:Nath₁:<{ ∅ / δ ⊢ ~(Tm.loc l✝) ⦂ Nat }>ih₁:∅ = ∅ → (Tm.loc l✝).IsValue ∨ ∃ t' ρ', Tm.loc l✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ ~(Tm.loc l✝) * t₂✝ }> / ρ ⟶ t' / ρ' δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₂✝:Tmh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₂:t₂✝.IsValuex✝:Stringτ₂✝:Tyt₁✝:Tmh₁:<{ ∅ / δ ⊢ λ ~x✝ : τ₂✝ . t₁✝ ⦂ Nat }>ih₁:∅ = ∅ → <{ λ ~x✝ : τ₂✝ . t₁✝ }>.IsValue ∨ ∃ t' ρ', <{ λ ~x✝ : τ₂✝ . t₁✝ }> / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ (λ ~x✝ : τ₂✝ . t₁✝) * t₂✝ }> / ρ ⟶ t' / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₂✝:Tmh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₂:t₂✝.IsValuen✝:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih₁:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ ~(Tm.const n✝) * t₂✝ }> / ρ ⟶ t' / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₂✝:Tmh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₂:t₂✝.IsValueh₁:<{ ∅ / δ ⊢ unit ⦂ Nat }>ih₁:∅ = ∅ → <{ unit }>.IsValue ∨ ∃ t' ρ', <{ unit }> / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ unit * t₂✝ }> / ρ ⟶ t' / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₂✝:Tmh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₂:t₂✝.IsValuel✝:Nath₁:<{ ∅ / δ ⊢ ~(Tm.loc l✝) ⦂ Nat }>ih₁:∅ = ∅ → (Tm.loc l✝).IsValue ∨ ∃ t' ρ', Tm.loc l✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ ~(Tm.loc l✝) * t₂✝ }> / ρ ⟶ t' / ρ' try All goals completed! 🐙
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextn✝:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih₁:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'x✝:Stringτ₂✝:Tyt₁✝:Tmh₂:<{ ∅ / δ ⊢ λ ~x✝ : τ₂✝ . t₁✝ ⦂ Nat }>ih₂:∅ = ∅ → <{ λ ~x✝ : τ₂✝ . t₁✝ }>.IsValue ∨ ∃ t' ρ', <{ λ ~x✝ : τ₂✝ . t₁✝ }> / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ ~(Tm.const n✝) * (λ ~x✝ : τ₂✝ . t₁✝) }> / ρ ⟶ t' / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextn✝¹:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih₁:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'n✝:Nath₂:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih₂:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ ~(Tm.const n✝¹) * ~(Tm.const n✝) }> / ρ ⟶ t' / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextn✝:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih₁:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'h₂:<{ ∅ / δ ⊢ unit ⦂ Nat }>ih₂:∅ = ∅ → <{ unit }>.IsValue ∨ ∃ t' ρ', <{ unit }> / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ ~(Tm.const n✝) * unit }> / ρ ⟶ t' / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextn✝:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih₁:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'l✝:Nath₂:<{ ∅ / δ ⊢ ~(Tm.loc l✝) ⦂ Nat }>ih₂:∅ = ∅ → (Tm.loc l✝).IsValue ∨ ∃ t' ρ', Tm.loc l✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ ~(Tm.const n✝) * ~(Tm.loc l✝) }> / ρ ⟶ t' / ρ' δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextn✝:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih₁:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'x✝:Stringτ₂✝:Tyt₁✝:Tmh₂:<{ ∅ / δ ⊢ λ ~x✝ : τ₂✝ . t₁✝ ⦂ Nat }>ih₂:∅ = ∅ → <{ λ ~x✝ : τ₂✝ . t₁✝ }>.IsValue ∨ ∃ t' ρ', <{ λ ~x✝ : τ₂✝ . t₁✝ }> / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ ~(Tm.const n✝) * (λ ~x✝ : τ₂✝ . t₁✝) }> / ρ ⟶ t' / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextn✝¹:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih₁:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'n✝:Nath₂:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih₂:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ ~(Tm.const n✝¹) * ~(Tm.const n✝) }> / ρ ⟶ t' / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextn✝:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih₁:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'h₂:<{ ∅ / δ ⊢ unit ⦂ Nat }>ih₂:∅ = ∅ → <{ unit }>.IsValue ∨ ∃ t' ρ', <{ unit }> / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ ~(Tm.const n✝) * unit }> / ρ ⟶ t' / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextn✝:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih₁:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'l✝:Nath₂:<{ ∅ / δ ⊢ ~(Tm.loc l✝) ⦂ Nat }>ih₂:∅ = ∅ → (Tm.loc l✝).IsValue ∨ ∃ t' ρ', Tm.loc l✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ ~(Tm.const n✝) * ~(Tm.loc l✝) }> / ρ ⟶ t' / ρ' try All goals completed! 🐙
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextn✝¹:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih₁:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'n✝:Nath₂:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih₂:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'⊢ ∃ ρ', <{ ~(Tm.const n✝¹) * ~(Tm.const n✝) }> / ρ ⟶ ?mult.inl.inl.nat.nat.w / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextn✝¹:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih₁:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'n✝:Nath₂:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih₂:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'⊢ Tm; δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextn✝¹:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih₁:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'n✝:Nath₂:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih₂:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'⊢ <{ ~(Tm.const n✝¹) * ~(Tm.const n✝) }> / ρ ⟶ ?mult.inl.inl.nat.nat.w / ?mult.inl.inl.nat.nat.h.wδ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextn✝¹:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih₁:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'n✝:Nath₂:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih₂:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'⊢ Storeδ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextn✝¹:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih₁:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'n✝:Nath₂:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih₂:∅ = ∅ → (Tm.const n✝).IsValue ∨ ∃ t' ρ', Tm.const n✝ / ρ ⟶ t' / ρ'⊢ Tm; All goals completed! 🐙
-- t₂ steps
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValuehs₂:∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ t₁✝ * t₂✝ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValuehs₂✝:∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ't₂':Tmρ':Storehs₂:t₂✝ / ρ ⟶ t₂' / ρ'⊢ ∃ t' ρ', <{ t₁✝ * t₂✝ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValuehs₂✝:∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ't₂':Tmρ':Storehs₂:t₂✝ / ρ ⟶ t₂' / ρ'⊢ ∃ ρ', <{ t₁✝ * t₂✝ }> / ρ ⟶ ?mult.inl.inr.w / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValuehs₂✝:∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ't₂':Tmρ':Storehs₂:t₂✝ / ρ ⟶ t₂' / ρ'⊢ Tm; δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValuehs₂✝:∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ't₂':Tmρ':Storehs₂:t₂✝ / ρ ⟶ t₂' / ρ'⊢ <{ t₁✝ * t₂✝ }> / ρ ⟶ ?mult.inl.inr.w / ?mult.inl.inr.h.wδ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValuehs₂✝:∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ't₂':Tmρ':Storehs₂:t₂✝ / ρ ⟶ t₂' / ρ'⊢ Storeδ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValuehs₂✝:∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ't₂':Tmρ':Storehs₂:t₂✝ / ρ ⟶ t₂' / ρ'⊢ Tm; All goals completed! 🐙
-- t₁ steps
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hs₁:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ t₁✝ * t₂✝ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hs₁✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs₁:t₁✝ / ρ ⟶ t₁' / ρ'⊢ ∃ t' ρ', <{ t₁✝ * t₂✝ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hs₁✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs₁:t₁✝ / ρ ⟶ t₁' / ρ'⊢ ∃ ρ', <{ t₁✝ * t₂✝ }> / ρ ⟶ ?mult.inr.w / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hs₁✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs₁:t₁✝ / ρ ⟶ t₁' / ρ'⊢ Tm; δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hs₁✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs₁:t₁✝ / ρ ⟶ t₁' / ρ'⊢ <{ t₁✝ * t₂✝ }> / ρ ⟶ ?mult.inr.w / ?mult.inr.h.wδ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hs₁✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs₁:t₁✝ / ρ ⟶ t₁' / ρ'⊢ Storeδ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'hs₁✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs₁:t₁✝ / ρ ⟶ t₁' / ρ'⊢ Tm; All goals completed! 🐙
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmt₃✝:Tmτ✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃✝:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'h₂_ih✝:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'h₃_ih✝:∅ = ∅ → t₃✝.IsValue ∨ ∃ t' ρ', t₃✝ / ρ ⟶ t' / ρ'⊢ <{ if0 t₁✝ then t₂✝ else t₃✝ }>.IsValue ∨ ∃ t' ρ', <{ if0 t₁✝ then t₂✝ else t₃✝ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmt₃✝:Tmτ✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃✝:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'h₂_ih✝:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'h₃_ih✝:∅ = ∅ → t₃✝.IsValue ∨ ∃ t' ρ', t₃✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ if0 t₁✝ then t₂✝ else t₃✝ }> / ρ ⟶ t' / ρ'; cases ih₁ (δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmt₃✝:Tmτ✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃✝:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'h₂_ih✝:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'h₃_ih✝:∅ = ∅ → t₃✝.IsValue ∨ ∃ t' ρ', t₃✝ / ρ ⟶ t' / ρ'⊢ ∅ = ∅ All goals completed! 🐙) with
-- t₁ is a value
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmt₃✝:Tmτ✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃✝:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'h₂_ih✝:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'h₃_ih✝:∅ = ∅ → t₃✝.IsValue ∨ ∃ t' ρ', t₃✝ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValue⊢ ∃ t' ρ', <{ if0 t₁✝ then t₂✝ else t₃✝ }> / ρ ⟶ t' / ρ'
cases hv₁ with (try All goals completed! 🐙)
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₂✝:Tmt₃✝:Tmτ✝:Tyh₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃✝:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>h₂_ih✝:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'h₃_ih✝:∅ = ∅ → t₃✝.IsValue ∨ ∃ t' ρ', t₃✝ / ρ ⟶ t' / ρ'n:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const n) ⦂ Nat }>ih₁:∅ = ∅ → (Tm.const n).IsValue ∨ ∃ t' ρ', Tm.const n / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ if0 ~(Tm.const n) then t₂✝ else t₃✝ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₂✝:Tmt₃✝:Tmτ✝:Tyh₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃✝:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>h₂_ih✝:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'h₃_ih✝:∅ = ∅ → t₃✝.IsValue ∨ ∃ t' ρ', t₃✝ / ρ ⟶ t' / ρ'h₁:<{ ∅ / δ ⊢ 0 ⦂ Nat }>ih₁:∅ = ∅ → <{ 0 }>.IsValue ∨ ∃ t' ρ', <{ 0 }> / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ if0 0 then t₂✝ else t₃✝ }> / ρ ⟶ t' / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₂✝:Tmt₃✝:Tmτ✝:Tyh₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃✝:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>h₂_ih✝:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'h₃_ih✝:∅ = ∅ → t₃✝.IsValue ∨ ∃ t' ρ', t₃✝ / ρ ⟶ t' / ρ'n✝:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const (n✝ + 1)) ⦂ Nat }>ih₁:∅ = ∅ → (Tm.const (n✝ + 1)).IsValue ∨ ∃ t' ρ', Tm.const (n✝ + 1) / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ if0 ~(Tm.const (n✝ + 1)) then t₂✝ else t₃✝ }> / ρ ⟶ t' / ρ' δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₂✝:Tmt₃✝:Tmτ✝:Tyh₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃✝:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>h₂_ih✝:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'h₃_ih✝:∅ = ∅ → t₃✝.IsValue ∨ ∃ t' ρ', t₃✝ / ρ ⟶ t' / ρ'h₁:<{ ∅ / δ ⊢ 0 ⦂ Nat }>ih₁:∅ = ∅ → <{ 0 }>.IsValue ∨ ∃ t' ρ', <{ 0 }> / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ if0 0 then t₂✝ else t₃✝ }> / ρ ⟶ t' / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₂✝:Tmt₃✝:Tmτ✝:Tyh₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃✝:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>h₂_ih✝:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'h₃_ih✝:∅ = ∅ → t₃✝.IsValue ∨ ∃ t' ρ', t₃✝ / ρ ⟶ t' / ρ'n✝:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const (n✝ + 1)) ⦂ Nat }>ih₁:∅ = ∅ → (Tm.const (n✝ + 1)).IsValue ∨ ∃ t' ρ', Tm.const (n✝ + 1) / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ if0 ~(Tm.const (n✝ + 1)) then t₂✝ else t₃✝ }> / ρ ⟶ t' / ρ' (δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₂✝:Tmt₃✝:Tmτ✝:Tyh₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃✝:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>h₂_ih✝:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'h₃_ih✝:∅ = ∅ → t₃✝.IsValue ∨ ∃ t' ρ', t₃✝ / ρ ⟶ t' / ρ'n✝:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const (n✝ + 1)) ⦂ Nat }>ih₁:∅ = ∅ → (Tm.const (n✝ + 1)).IsValue ∨ ∃ t' ρ', Tm.const (n✝ + 1) / ρ ⟶ t' / ρ'⊢ ∃ ρ', <{ if0 ~(Tm.const (n✝ + 1)) then t₂✝ else t₃✝ }> / ρ ⟶ ?ite0.inl.nat.succ.w / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₂✝:Tmt₃✝:Tmτ✝:Tyh₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃✝:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>h₂_ih✝:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'h₃_ih✝:∅ = ∅ → t₃✝.IsValue ∨ ∃ t' ρ', t₃✝ / ρ ⟶ t' / ρ'n✝:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const (n✝ + 1)) ⦂ Nat }>ih₁:∅ = ∅ → (Tm.const (n✝ + 1)).IsValue ∨ ∃ t' ρ', Tm.const (n✝ + 1) / ρ ⟶ t' / ρ'⊢ Tm; δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₂✝:Tmt₃✝:Tmτ✝:Tyh₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃✝:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>h₂_ih✝:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'h₃_ih✝:∅ = ∅ → t₃✝.IsValue ∨ ∃ t' ρ', t₃✝ / ρ ⟶ t' / ρ'n✝:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const (n✝ + 1)) ⦂ Nat }>ih₁:∅ = ∅ → (Tm.const (n✝ + 1)).IsValue ∨ ∃ t' ρ', Tm.const (n✝ + 1) / ρ ⟶ t' / ρ'⊢ <{ if0 ~(Tm.const (n✝ + 1)) then t₂✝ else t₃✝ }> / ρ ⟶ ?ite0.inl.nat.succ.w / ?ite0.inl.nat.succ.h.wδ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₂✝:Tmt₃✝:Tmτ✝:Tyh₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃✝:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>h₂_ih✝:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'h₃_ih✝:∅ = ∅ → t₃✝.IsValue ∨ ∃ t' ρ', t₃✝ / ρ ⟶ t' / ρ'n✝:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const (n✝ + 1)) ⦂ Nat }>ih₁:∅ = ∅ → (Tm.const (n✝ + 1)).IsValue ∨ ∃ t' ρ', Tm.const (n✝ + 1) / ρ ⟶ t' / ρ'⊢ Storeδ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₂✝:Tmt₃✝:Tmτ✝:Tyh₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃✝:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>h₂_ih✝:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'h₃_ih✝:∅ = ∅ → t₃✝.IsValue ∨ ∃ t' ρ', t₃✝ / ρ ⟶ t' / ρ'n✝:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const (n✝ + 1)) ⦂ Nat }>ih₁:∅ = ∅ → (Tm.const (n✝ + 1)).IsValue ∨ ∃ t' ρ', Tm.const (n✝ + 1) / ρ ⟶ t' / ρ'⊢ Tm; All goals completed! 🐙)
-- t₁ steps
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmt₃✝:Tmτ✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃✝:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'h₂_ih✝:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'h₃_ih✝:∅ = ∅ → t₃✝.IsValue ∨ ∃ t' ρ', t₃✝ / ρ ⟶ t' / ρ'hs₁:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ if0 t₁✝ then t₂✝ else t₃✝ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmt₃✝:Tmτ✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃✝:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'h₂_ih✝:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'h₃_ih✝:∅ = ∅ → t₃✝.IsValue ∨ ∃ t' ρ', t₃✝ / ρ ⟶ t' / ρ'hs₁✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs₁:t₁✝ / ρ ⟶ t₁' / ρ'⊢ ∃ t' ρ', <{ if0 t₁✝ then t₂✝ else t₃✝ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmt₃✝:Tmτ✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃✝:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'h₂_ih✝:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'h₃_ih✝:∅ = ∅ → t₃✝.IsValue ∨ ∃ t' ρ', t₃✝ / ρ ⟶ t' / ρ'hs₁✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs₁:t₁✝ / ρ ⟶ t₁' / ρ'⊢ ∃ ρ', <{ if0 t₁✝ then t₂✝ else t₃✝ }> / ρ ⟶ ?ite0.inr.w / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmt₃✝:Tmτ✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃✝:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'h₂_ih✝:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'h₃_ih✝:∅ = ∅ → t₃✝.IsValue ∨ ∃ t' ρ', t₃✝ / ρ ⟶ t' / ρ'hs₁✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs₁:t₁✝ / ρ ⟶ t₁' / ρ'⊢ Tm; δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmt₃✝:Tmτ✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃✝:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'h₂_ih✝:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'h₃_ih✝:∅ = ∅ → t₃✝.IsValue ∨ ∃ t' ρ', t₃✝ / ρ ⟶ t' / ρ'hs₁✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs₁:t₁✝ / ρ ⟶ t₁' / ρ'⊢ <{ if0 t₁✝ then t₂✝ else t₃✝ }> / ρ ⟶ ?ite0.inr.w / ?ite0.inr.h.wδ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmt₃✝:Tmτ✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃✝:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'h₂_ih✝:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'h₃_ih✝:∅ = ∅ → t₃✝.IsValue ∨ ∃ t' ρ', t₃✝ / ρ ⟶ t' / ρ'hs₁✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs₁:t₁✝ / ρ ⟶ t₁' / ρ'⊢ Storeδ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂✝:Tmt₃✝:Tmτ✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂✝:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃✝:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'h₂_ih✝:∅ = ∅ → t₂✝.IsValue ∨ ∃ t' ρ', t₂✝ / ρ ⟶ t' / ρ'h₃_ih✝:∅ = ∅ → t₃✝.IsValue ∨ ∃ t' ρ', t₃✝ / ρ ⟶ t' / ρ'hs₁✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs₁:t₁✝ / ρ ⟶ t₁' / ρ'⊢ Tm; All goals completed! 🐙
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmτ₁✝:Tyh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁✝ }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'⊢ <{ ref t₁✝ }>.IsValue ∨ ∃ t' ρ', <{ ref t₁✝ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmτ₁✝:Tyh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁✝ }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ ref t₁✝ }> / ρ ⟶ t' / ρ'; cases ih (δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmτ₁✝:Tyh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁✝ }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'⊢ ∅ = ∅ All goals completed! 🐙) with
-- t₁ is a value
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmτ₁✝:Tyh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁✝ }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hv:t₁✝.IsValue⊢ ∃ t' ρ', <{ ref t₁✝ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmτ₁✝:Tyh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁✝ }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hv:t₁✝.IsValue⊢ ∃ ρ', <{ ref t₁✝ }> / ρ ⟶ ?ref_.inl.w / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmτ₁✝:Tyh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁✝ }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hv:t₁✝.IsValue⊢ Tm; δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmτ₁✝:Tyh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁✝ }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hv:t₁✝.IsValue⊢ <{ ref t₁✝ }> / ρ ⟶ ?ref_.inl.w / ?ref_.inl.h.wδ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmτ₁✝:Tyh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁✝ }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hv:t₁✝.IsValue⊢ Storeδ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmτ₁✝:Tyh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁✝ }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hv:t₁✝.IsValue⊢ Tm; All goals completed! 🐙
-- t₁ steps
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmτ₁✝:Tyh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁✝ }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hs:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ ref t₁✝ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmτ₁✝:Tyh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁✝ }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hs✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs:t₁✝ / ρ ⟶ t₁' / ρ'⊢ ∃ t' ρ', <{ ref t₁✝ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmτ₁✝:Tyh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁✝ }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hs✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs:t₁✝ / ρ ⟶ t₁' / ρ'⊢ ∃ ρ', <{ ref t₁✝ }> / ρ ⟶ ?ref_.inr.w / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmτ₁✝:Tyh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁✝ }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hs✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs:t₁✝ / ρ ⟶ t₁' / ρ'⊢ Tm; δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmτ₁✝:Tyh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁✝ }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hs✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs:t₁✝ / ρ ⟶ t₁' / ρ'⊢ <{ ref t₁✝ }> / ρ ⟶ ?ref_.inr.w / ?ref_.inr.h.wδ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmτ₁✝:Tyh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁✝ }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hs✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs:t₁✝ / ρ ⟶ t₁' / ρ'⊢ Storeδ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmτ₁✝:Tyh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁✝ }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hs✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs:t₁✝ / ρ ⟶ t₁' / ρ'⊢ Tm; All goals completed! 🐙
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmτ₁✝:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₁✝ }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'⊢ <{ !t₁✝ }>.IsValue ∨ ∃ t' ρ', <{ !t₁✝ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmτ₁✝:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₁✝ }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ !t₁✝ }> / ρ ⟶ t' / ρ'; cases ih (δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmτ₁✝:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₁✝ }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'⊢ ∅ = ∅ All goals completed! 🐙) with
-- t₁ is a value; its typing tells us `l < δ.length`, and
-- `hLen` turns this into `l < ρ.length`, so `ρ[l]` is
-- actually defined and we can step to it
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmτ₁✝:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₁✝ }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hv:t₁✝.IsValue⊢ ∃ t' ρ', <{ !t₁✝ }> / ρ ⟶ t' / ρ'
cases hv with (All goals completed! 🐙)
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextl:Natih:∅ = ∅ → (Tm.loc l).IsValue ∨ ∃ t' ρ', Tm.loc l / ρ ⟶ t' / ρ'h✝:l < List.length δ⊢ ∃ t' ρ', <{ !~(Tm.loc l) }> / ρ ⟶ t' / ρ' δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextl:Natih:∅ = ∅ → (Tm.loc l).IsValue ∨ ∃ t' ρ', Tm.loc l / ρ ⟶ t' / ρ'h✝:l < List.length δ⊢ <{ !~(Tm.loc l) }> / ρ ⟶ ρ[l] / ρ; δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextl:Natih:∅ = ∅ → (Tm.loc l).IsValue ∨ ∃ t' ρ', Tm.loc l / ρ ⟶ t' / ρ'h✝:l < List.length δ⊢ l < List.length ρ; All goals completed! 🐙
-- t₁ steps
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmτ₁✝:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₁✝ }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hs:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ !t₁✝ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmτ₁✝:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₁✝ }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hs✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs:t₁✝ / ρ ⟶ t₁' / ρ'⊢ ∃ t' ρ', <{ !t₁✝ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmτ₁✝:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₁✝ }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hs✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs:t₁✝ / ρ ⟶ t₁' / ρ'⊢ ∃ ρ', <{ !t₁✝ }> / ρ ⟶ ?deref.inr.w / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmτ₁✝:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₁✝ }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hs✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs:t₁✝ / ρ ⟶ t₁' / ρ'⊢ Tm; δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmτ₁✝:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₁✝ }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hs✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs:t₁✝ / ρ ⟶ t₁' / ρ'⊢ <{ !t₁✝ }> / ρ ⟶ ?deref.inr.w / ?deref.inr.h.wδ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmτ₁✝:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₁✝ }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hs✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs:t₁✝ / ρ ⟶ t₁' / ρ'⊢ Storeδ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmτ₁✝:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₁✝ }>ih:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'hs✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs:t₁✝ / ρ ⟶ t₁' / ρ'⊢ Tm; All goals completed! 🐙
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂✝:<{ ∅ / δ ⊢ t₂ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂.IsValue ∨ ∃ t' ρ', t₂ / ρ ⟶ t' / ρ'⊢ <{ t₁✝ := t₂ }>.IsValue ∨ ∃ t' ρ', <{ t₁✝ := t₂ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂✝:<{ ∅ / δ ⊢ t₂ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂.IsValue ∨ ∃ t' ρ', t₂ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ t₁✝ := t₂ }> / ρ ⟶ t' / ρ'; cases ih₁ (δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂✝:<{ ∅ / δ ⊢ t₂ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂.IsValue ∨ ∃ t' ρ', t₂ / ρ ⟶ t' / ρ'⊢ ∅ = ∅ All goals completed! 🐙) with
-- t₁ is a value
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂✝:<{ ∅ / δ ⊢ t₂ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂.IsValue ∨ ∃ t' ρ', t₂ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValue⊢ ∃ t' ρ', <{ t₁✝ := t₂ }> / ρ ⟶ t' / ρ'
cases ih₂ (δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂✝:<{ ∅ / δ ⊢ t₂ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂.IsValue ∨ ∃ t' ρ', t₂ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValue⊢ ∅ = ∅ All goals completed! 🐙) with
-- t₂ is a value
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂✝:<{ ∅ / δ ⊢ t₂ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂.IsValue ∨ ∃ t' ρ', t₂ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValuehv₂:t₂.IsValue⊢ ∃ t' ρ', <{ t₁✝ := t₂ }> / ρ ⟶ t' / ρ'
-- as in `deref`, `hLen` turns `l < δ.length` into
-- `l < ρ.length`, so `ρ.set l t₂` is well defined
cases hv₁ with (All goals completed! 🐙)
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₂:Tmih₂:∅ = ∅ → t₂.IsValue ∨ ∃ t' ρ', t₂ / ρ ⟶ t' / ρ'hv₂:t₂.IsValuel:Natih₁:∅ = ∅ → (Tm.loc l).IsValue ∨ ∃ t' ρ', Tm.loc l / ρ ⟶ t' / ρ'h✝:l < List.length δh₂✝:<{ ∅ / δ ⊢ t₂ ⦂ ~δ[l] }>⊢ ∃ t' ρ', <{ ~(Tm.loc l) := t₂ }> / ρ ⟶ t' / ρ' δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₂:Tmih₂:∅ = ∅ → t₂.IsValue ∨ ∃ t' ρ', t₂ / ρ ⟶ t' / ρ'hv₂:t₂.IsValuel:Natih₁:∅ = ∅ → (Tm.loc l).IsValue ∨ ∃ t' ρ', Tm.loc l / ρ ⟶ t' / ρ'h✝:l < List.length δh₂✝:<{ ∅ / δ ⊢ t₂ ⦂ ~δ[l] }>⊢ <{ ~(Tm.loc l) := t₂ }> / ρ ⟶ <{ unit }> / List.set ρ l t₂; δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₂:Tmih₂:∅ = ∅ → t₂.IsValue ∨ ∃ t' ρ', t₂ / ρ ⟶ t' / ρ'hv₂:t₂.IsValuel:Natih₁:∅ = ∅ → (Tm.loc l).IsValue ∨ ∃ t' ρ', Tm.loc l / ρ ⟶ t' / ρ'h✝:l < List.length δh₂✝:<{ ∅ / δ ⊢ t₂ ⦂ ~δ[l] }>⊢ l < List.length ρ; All goals completed! 🐙
-- t₂ steps
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂✝:<{ ∅ / δ ⊢ t₂ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂.IsValue ∨ ∃ t' ρ', t₂ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValuehs₂:∃ t' ρ', t₂ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ t₁✝ := t₂ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂✝:<{ ∅ / δ ⊢ t₂ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂.IsValue ∨ ∃ t' ρ', t₂ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValuehs₂:∃ t' ρ', t₂ / ρ ⟶ t' / ρ'w✝¹:Tmw✝:Storeh✝:t₂ / ρ ⟶ w✝¹ / w✝⊢ ∃ t' ρ', <{ t₁✝ := t₂ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂✝:<{ ∅ / δ ⊢ t₂ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂.IsValue ∨ ∃ t' ρ', t₂ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValuehs₂:∃ t' ρ', t₂ / ρ ⟶ t' / ρ'w✝¹:Tmw✝:Storeh✝:t₂ / ρ ⟶ w✝¹ / w✝⊢ ∃ ρ', <{ t₁✝ := t₂ }> / ρ ⟶ ?assign.inl.inr.w / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂✝:<{ ∅ / δ ⊢ t₂ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂.IsValue ∨ ∃ t' ρ', t₂ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValuehs₂:∃ t' ρ', t₂ / ρ ⟶ t' / ρ'w✝¹:Tmw✝:Storeh✝:t₂ / ρ ⟶ w✝¹ / w✝⊢ Tm; δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂✝:<{ ∅ / δ ⊢ t₂ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂.IsValue ∨ ∃ t' ρ', t₂ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValuehs₂:∃ t' ρ', t₂ / ρ ⟶ t' / ρ'w✝¹:Tmw✝:Storeh✝:t₂ / ρ ⟶ w✝¹ / w✝⊢ <{ t₁✝ := t₂ }> / ρ ⟶ ?assign.inl.inr.w / ?assign.inl.inr.h.wδ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂✝:<{ ∅ / δ ⊢ t₂ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂.IsValue ∨ ∃ t' ρ', t₂ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValuehs₂:∃ t' ρ', t₂ / ρ ⟶ t' / ρ'w✝¹:Tmw✝:Storeh✝:t₂ / ρ ⟶ w✝¹ / w✝⊢ Storeδ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂✝:<{ ∅ / δ ⊢ t₂ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂.IsValue ∨ ∃ t' ρ', t₂ / ρ ⟶ t' / ρ'hv₁:t₁✝.IsValuehs₂:∃ t' ρ', t₂ / ρ ⟶ t' / ρ'w✝¹:Tmw✝:Storeh✝:t₂ / ρ ⟶ w✝¹ / w✝⊢ Tm; All goals completed! 🐙
-- t₁ steps
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂✝:<{ ∅ / δ ⊢ t₂ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂.IsValue ∨ ∃ t' ρ', t₂ / ρ ⟶ t' / ρ'hs₁:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'⊢ ∃ t' ρ', <{ t₁✝ := t₂ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂✝:<{ ∅ / δ ⊢ t₂ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂.IsValue ∨ ∃ t' ρ', t₂ / ρ ⟶ t' / ρ'hs₁✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs₁:t₁✝ / ρ ⟶ t₁' / ρ'⊢ ∃ t' ρ', <{ t₁✝ := t₂ }> / ρ ⟶ t' / ρ'
δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂✝:<{ ∅ / δ ⊢ t₂ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂.IsValue ∨ ∃ t' ρ', t₂ / ρ ⟶ t' / ρ'hs₁✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs₁:t₁✝ / ρ ⟶ t₁' / ρ'⊢ ∃ ρ', <{ t₁✝ := t₂ }> / ρ ⟶ ?assign.inr.w / ρ'δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂✝:<{ ∅ / δ ⊢ t₂ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂.IsValue ∨ ∃ t' ρ', t₂ / ρ ⟶ t' / ρ'hs₁✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs₁:t₁✝ / ρ ⟶ t₁' / ρ'⊢ Tm; δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂✝:<{ ∅ / δ ⊢ t₂ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂.IsValue ∨ ∃ t' ρ', t₂ / ρ ⟶ t' / ρ'hs₁✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs₁:t₁✝ / ρ ⟶ t₁' / ρ'⊢ <{ t₁✝ := t₂ }> / ρ ⟶ ?assign.inr.w / ?assign.inr.h.wδ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂✝:<{ ∅ / δ ⊢ t₂ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂.IsValue ∨ ∃ t' ρ', t₂ / ρ ⟶ t' / ρ'hs₁✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs₁:t₁✝ / ρ ⟶ t₁' / ρ'⊢ Storeδ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρhLen:List.length δ = List.length ρright✝:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmt₂:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂✝:<{ ∅ / δ ⊢ t₂ ⦂ τ₂✝ }>ih₁:∅ = ∅ → t₁✝.IsValue ∨ ∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ'ih₂:∅ = ∅ → t₂.IsValue ∨ ∃ t' ρ', t₂ / ρ ⟶ t' / ρ'hs₁✝:∃ t' ρ', t₁✝ / ρ ⟶ t' / ρ't₁':Tmρ':Storehs₁:t₁✝ / ρ ⟶ t₁' / ρ'⊢ Tm; All goals completed! 🐙
9.5.3. Extending Store Typings
Having proved progress, let's turn our attention to preservation.
Here is a first attempt at stating it, using the StoreWellTyped
relation we just defined:
theorem preservation_wrong (δ : StoreTy) (τ : Ty) (t t' : Tm) (ρ ρ' : Store) :
<{ ∅ / δ ⊢ t ⦂ τ }> →
t / ρ ⟶ t' / ρ' →
δ ⊢ ρ →
<{ ∅ / δ ⊢ t' ⦂ τ }> := by
This works... for all but one of the reduction rules! (Which?)
The refValue rule is the problem
-------------------------- (refValue)
ref v / ρ ⟶ loc |ρ| / ρ,v
It allocates a fresh location l and adds it to the store, but
the store typing δ doesn't know about l, so t' won't be
typeable under δ.
For example, the term ref 5 is typeable in the ∅ context and
∅ store typing, but it steps to loc 0, which is not typeable
with an ∅ store typing.
Intuition: Since the store can grow during reduction, we need to let the store typing grow too...
inductive Extends : StoreTy → StoreTy → Prop where
| nil (δ' : StoreTy) : Extends δ' []
| cons (τ : Ty) {δ' δ : StoreTy} (h : Extends δ' δ) :
Extends (τ::δ') (τ::δ)
attribute [StlcRefTyping] Extends.nil Extends.cons
For example, the store typing [Nat] with a single location of
type Nat extends the empty store typing.
We'll need a few technical lemmas about extended contexts. First, looking up a type in an extended store typing yields the same result as in the original:
theorem extends_lookup {l : Nat} {δ δ' : StoreTy}
(h₁ : l < δ.length)
(h₂ : Extends δ' δ) :
δ'[l] = δ[l] := l:Natδ:StoreTyδ':StoreTyh₁:l < List.length δh₂:Extends δ' δ⊢ δ'[l] = δ[l]
induction δ generalizing l δ' with
l:Natδ':StoreTyh₁:l < [].lengthh₂:Extends δ' []⊢ δ'[l] = [][l] All goals completed! 🐙
hd:Tytl:List Tyih:∀ {l : Nat} {δ' : StoreTy}, l < tl.length → Extends δ' tl → δ'[l] = tl[l]l:Natδ':StoreTyh₁:l < (hd :: tl).lengthh₂:Extends δ' (hd :: tl)⊢ δ'[l] = (hd :: tl)[l]
cases δ' with
hd:Tytl:List Tyih:∀ {l : Nat} {δ' : StoreTy}, l < tl.length → Extends δ' tl → δ'[l] = tl[l]l:Nath₁:l < (hd :: tl).lengthh₂:Extends [] (hd :: tl)⊢ [][l] = (hd :: tl)[l] All goals completed! 🐙
hd:Tytl:List Tyih:∀ {l : Nat} {δ' : StoreTy}, l < tl.length → Extends δ' tl → δ'[l] = tl[l]l:Nath₁:l < (hd :: tl).lengthhd':Tytl':List Tyh₂:Extends (hd' :: tl') (hd :: tl)⊢ (hd' :: tl')[l] = (hd :: tl)[l]
hd:Tytl:List Tyih:∀ {l : Nat} {δ' : StoreTy}, l < tl.length → Extends δ' tl → δ'[l] = tl[l]l:Nath₁:l < (hd :: tl).lengthtl':List Tyh✝:Extends tl' tl⊢ (hd :: tl')[l] = (hd :: tl)[l]
cases l with
hd:Tytl:List Tyih:∀ {l : Nat} {δ' : StoreTy}, l < tl.length → Extends δ' tl → δ'[l] = tl[l]tl':List Tyh✝:Extends tl' tlh₁:0 < (hd :: tl).length⊢ (hd :: tl')[0] = (hd :: tl)[0] All goals completed! 🐙
hd:Tytl:List Tyih:∀ {l : Nat} {δ' : StoreTy}, l < tl.length → Extends δ' tl → δ'[l] = tl[l]tl':List Tyh✝:Extends tl' tll:Nath₁:l + 1 < (hd :: tl).length⊢ (hd :: tl')[l + 1] = (hd :: tl)[l + 1]
hd:Tytl:List Tyih:∀ {l : Nat} {δ' : StoreTy}, l < tl.length → Extends δ' tl → δ'[l] = tl[l]tl':List Tyh✝:Extends tl' tll:Nath₁:l + 1 < (hd :: tl).length⊢ tl'[l] = tl[l]; hd:Tytl:List Tyih:∀ {l : Nat} {δ' : StoreTy}, l < tl.length → Extends δ' tl → δ'[l] = tl[l]tl':List Tyh✝:Extends tl' tll:Nath₁:l + 1 < (hd :: tl).length⊢ l < tl.lengthhd:Tytl:List Tyih:∀ {l : Nat} {δ' : StoreTy}, l < tl.length → Extends δ' tl → δ'[l] = tl[l]tl':List Tyh✝:Extends tl' tll:Nath₁:l + 1 < (hd :: tl).length⊢ Extends tl' tl
hd:Tytl:List Tyih:∀ {l : Nat} {δ' : StoreTy}, l < tl.length → Extends δ' tl → δ'[l] = tl[l]tl':List Tyh✝:Extends tl' tll:Nath₁:l + 1 < (hd :: tl).length⊢ l < tl.length All goals completed! 🐙
hd:Tytl:List Tyih:∀ {l : Nat} {δ' : StoreTy}, l < tl.length → Extends δ' tl → δ'[l] = tl[l]tl':List Tyh✝:Extends tl' tll:Nath₁:l + 1 < (hd :: tl).length⊢ Extends tl' tl All goals completed! 🐙
Next, if δ' extends δ, the length of δ' is at least that of δ.
theorem length_extends {l : Nat} {δ δ' : StoreTy}
(h₁ : l < δ.length)
(h₂ : Extends δ' δ) :
l < δ'.length := l:Natδ:StoreTyδ':StoreTyh₁:l < List.length δh₂:Extends δ' δ⊢ l < List.length δ'
induction h₂ generalizing l with
δ:StoreTyδ':StoreTyδ'✝:StoreTyl:Nath₁:l < [].length⊢ l < List.length δ'✝ All goals completed! 🐙
δ:StoreTyδ':StoreTyτ:Tyδ'✝:StoreTyδ✝:StoreTyh:Extends δ'✝ δ✝ih:∀ {l : Nat}, l < List.length δ✝ → l < List.length δ'✝l:Nath₁:l < (τ :: δ✝).length⊢ l < (τ :: δ'✝).length
δ:StoreTyδ':StoreTyτ:Tyδ'✝:StoreTyδ✝:StoreTyh:Extends δ'✝ δ✝ih:∀ {l : Nat}, l < List.length δ✝ → l < List.length δ'✝l:Nath₁:l < (τ :: δ✝).length⊢ l < List.length δ'✝ + 1
cases l with
δ:StoreTyδ':StoreTyτ:Tyδ'✝:StoreTyδ✝:StoreTyh:Extends δ'✝ δ✝ih:∀ {l : Nat}, l < List.length δ✝ → l < List.length δ'✝h₁:0 < (τ :: δ✝).length⊢ 0 < List.length δ'✝ + 1 All goals completed! 🐙
δ:StoreTyδ':StoreTyτ:Tyδ'✝:StoreTyδ✝:StoreTyh:Extends δ'✝ δ✝ih:∀ {l : Nat}, l < List.length δ✝ → l < List.length δ'✝l':Nath₁:l' + 1 < (τ :: δ✝).length⊢ l' + 1 < List.length δ'✝ + 1
δ:StoreTyδ':StoreTyτ:Tyδ'✝:StoreTyδ✝:StoreTyh:Extends δ'✝ δ✝ih:∀ {l : Nat}, l < List.length δ✝ → l < List.length δ'✝l':Nath₁:l' + 1 < (τ :: δ✝).length⊢ l' < List.length δ'✝; δ:StoreTyδ':StoreTyτ:Tyδ'✝:StoreTyδ✝:StoreTyh:Extends δ'✝ δ✝ih:∀ {l : Nat}, l < List.length δ✝ → l < List.length δ'✝l':Nath₁:l' + 1 < (τ :: δ✝).length⊢ l' < List.length δ✝
All goals completed! 🐙
Finally, δ ++ δ' extends δ, and Extends is reflexive.
theorem extends_app (δ δ' : StoreTy) : Extends (δ ++ δ') δ := δ:StoreTyδ':StoreTy⊢ Extends (δ ++ δ') δ
δ':StoreTy⊢ Extends ([] ++ δ') []head✝:Tytail✝:List Tytail_ih✝:∀ (δ' : StoreTy), Extends (tail✝ ++ δ') tail✝δ':StoreTy⊢ Extends (head✝ :: tail✝ ++ δ') (head✝ :: tail✝) δ':StoreTy⊢ Extends ([] ++ δ') []head✝:Tytail✝:List Tytail_ih✝:∀ (δ' : StoreTy), Extends (tail✝ ++ δ') tail✝δ':StoreTy⊢ Extends (head✝ :: tail✝ ++ δ') (head✝ :: tail✝) All goals completed! 🐙
theorem extends_refl (δ : StoreTy) : Extends δ δ := δ:StoreTy⊢ Extends δ δ
⊢ Extends [] []head✝:Tytail✝:List Tytail_ih✝:Extends tail✝ tail✝⊢ Extends (head✝ :: tail✝) (head✝ :: tail✝) ⊢ Extends [] []head✝:Tytail✝:List Tytail_ih✝:Extends tail✝ tail✝⊢ Extends (head✝ :: tail✝) (head✝ :: tail✝) All goals completed! 🐙
9.5.4. Preservation
We can now give the correct statement of the type preservation property:
def preservation_theorem {δ : StoreTy} {t t' : Tm} {τ : Ty} {ρ ρ' : Store} :=
(hTy : <{ ∅ / δ ⊢ t ⦂ τ }>) →
(hStoreTy : δ ⊢ ρ) →
(hEval : t / ρ ⟶ t' / ρ') →
∃ δ', Extends δ' δ ∧ (<{ ∅ / δ' ⊢ t' ⦂ τ }>) ∧ (δ' ⊢ ρ')
This gives us just what we need to "turn the crank" when applying the theorem to multi-step reduction sequences.
9.5.4.1. Substitution Lemma
To prove preservation, we need to re-develop the rest of the machinery that we saw for the pure STLC (plus a couple of new things about store typings and extension)...
theorem weakening {Γ Γ' : Context} {δ : StoreTy} {t : Tm} {τ: Ty}
(hi : Γ ⊆ Γ')
(ht : <{ Γ / δ ⊢ t ⦂ τ }>) :
<{ Γ' / δ ⊢ t ⦂ τ }> := Γ:ContextΓ':Contextδ:StoreTyt:Tmτ:Tyhi:Γ ⊆ Γ'ht:<{ Γ / δ ⊢ t ⦂ τ }>⊢ <{ Γ' / δ ⊢ t ⦂ τ }>
induction ht generalizing Γ' with (All goals completed! 🐙)
theorem weakening_empty {Γ : Context} {δ : StoreTy} {t : Tm} {τ: Ty}
(ht :<{ ∅ / δ ⊢ t ⦂ τ }>) :
<{ Γ / δ ⊢ t ⦂ τ }> := Γ:Contextδ:StoreTyt:Tmτ:Tyht:<{ ∅ / δ ⊢ t ⦂ τ }>⊢ <{ Γ / δ ⊢ t ⦂ τ }>
Γ:Contextδ:StoreTyt:Tmτ:Tyht:<{ ∅ / δ ⊢ t ⦂ τ }>⊢ ∅ ⊆ ΓΓ:Contextδ:StoreTyt:Tmτ:Tyht:<{ ∅ / δ ⊢ t ⦂ τ }>⊢ <{ ∅ / δ ⊢ t ⦂ τ }>
Γ:Contextδ:StoreTyt:Tmτ:Tyht:<{ ∅ / δ ⊢ t ⦂ τ }>⊢ ∅ ⊆ Γ Γ:Contextδ:StoreTyt:Tmτ:Tyht:<{ ∅ / δ ⊢ t ⦂ τ }>x:Stringb:Tycontra:∅[x] = some b⊢ Γ[x] = some b
All goals completed! 🐙
Γ:Contextδ:StoreTyt:Tmτ:Tyht:<{ ∅ / δ ⊢ t ⦂ τ }>⊢ <{ ∅ / δ ⊢ t ⦂ τ }> All goals completed! 🐙
theorem substitution_preserves_typing (Γ : Context) (δ : StoreTy) (x : String)
(τ₁ : Ty) (t v : Tm) (τ : Ty)
(ht : <{ x ↦ τ₁ ; Γ / δ⊢ t ⦂ τ }>)
(hv : <{ ∅ / δ ⊢ v ⦂ τ₁ }>) :
<{ Γ / δ ⊢ [x := v] t ⦂ τ }> := Γ:Contextδ:StoreTyx:Stringτ₁:Tyt:Tmv:Tmτ:Tyht:<{ ~(x →ₚ τ₁ ; Γ) / δ ⊢ t ⦂ τ }>hv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>⊢ <{ Γ / δ ⊢ [~x := v] t ⦂ τ }>
induction t generalizing Γ τ with (
loc δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>a✝:NatΓ:Contextτ:Tyht:<{ ~(x →ₚ τ₁ ; Γ) / δ ⊢ ~(Tm.loc a✝) ⦂ τ }>⊢ <{ Γ / δ ⊢ ~(Tm.loc a✝) ⦂ τ }>; try (inversion ht loc_ δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>a✝:NatΓ:Contexth✝:a✝ < List.length δ⊢ <{ Γ / δ ⊢ ~(Tm.loc a✝) ⦂ Ref ~δ[a✝] }>; apply_rules using StlcRefTyping All goals completed! 🐙; done))
| var y => var δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>y:StringΓ:Contextτ:Tyht:<{ ~(x →ₚ τ₁ ; Γ) / δ ⊢ ~(STLCRef.Tm.var y) ⦂ τ }>⊢ <{ Γ / δ ⊢ ~(if x = y then v else STLCRef.Tm.var y) ⦂ τ }>
inversion ht with | _ h => var δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>y:StringΓ:Contextτ:Tyh:(x →ₚ τ₁ ; Γ)[y] = some τ⊢ <{ Γ / δ ⊢ ~(if x = y then v else STLCRef.Tm.var y) ⦂ τ }>
by_cases h₁ : x = y pos δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>y:StringΓ:Contextτ:Tyh:(x →ₚ τ₁ ; Γ)[y] = some τh₁:x = y⊢ <{ Γ / δ ⊢ ~(if x = y then v else STLCRef.Tm.var y) ⦂ τ }>neg δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>y:StringΓ:Contextτ:Tyh:(x →ₚ τ₁ ; Γ)[y] = some τh₁:¬x = y⊢ <{ Γ / δ ⊢ ~(if x = y then v else STLCRef.Tm.var y) ⦂ τ }>
· pos δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>y:StringΓ:Contextτ:Tyh:(x →ₚ τ₁ ; Γ)[y] = some τh₁:x = y⊢ <{ Γ / δ ⊢ ~(if x = y then v else STLCRef.Tm.var y) ⦂ τ }> subst h₁ pos δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>Γ:Contextτ:Tyh:(x →ₚ τ₁ ; Γ)[x] = some τ⊢ <{ Γ / δ ⊢ ~(if x = x then v else STLCRef.Tm.var x) ⦂ τ }>; simp at h pos δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>Γ:Contextτ:Tyh:τ₁ = τ⊢ <{ Γ / δ ⊢ ~(if x = x then v else STLCRef.Tm.var x) ⦂ τ }>; subst h pos δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>Γ:Context⊢ <{ Γ / δ ⊢ ~(if x = x then v else STLCRef.Tm.var x) ⦂ τ₁ }>;
apply weakening_empty at hv pos δ:StoreTyx:Stringτ₁:Tyv:Tmhv✝:<{ ∅ / δ ⊢ v ⦂ τ₁ }>Γ:Contexthv:<{ ~?Γ / δ ⊢ v ⦂ τ₁ }>⊢ <{ Γ / δ ⊢ ~(if x = x then v else STLCRef.Tm.var x) ⦂ τ₁ }>Γ δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>Γ:Context⊢ Context
simp pos δ:StoreTyx:Stringτ₁:Tyv:Tmhv✝:<{ ∅ / δ ⊢ v ⦂ τ₁ }>Γ:Contexthv:<{ ~?Γ / δ ⊢ v ⦂ τ₁ }>⊢ <{ Γ / δ ⊢ v ⦂ τ₁ }>Γ δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>Γ:Context⊢ Context; assumption All goals completed! 🐙
· neg δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>y:StringΓ:Contextτ:Tyh:(x →ₚ τ₁ ; Γ)[y] = some τh₁:¬x = y⊢ <{ Γ / δ ⊢ ~(if x = y then v else STLCRef.Tm.var y) ⦂ τ }> rw [PartialMap.update_neq neg δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>y:StringΓ:Contextτ:Tyh:Γ[y] = some τh₁:¬x = y⊢ <{ Γ / δ ⊢ ~(if x = y then v else STLCRef.Tm.var y) ⦂ τ }>neg.h δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>y:StringΓ:Contextτ:Tyh:(x →ₚ τ₁ ; Γ)[y] = some τh₁:¬x = y⊢ x ≠ y] at h neg δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>y:StringΓ:Contextτ:Tyh:Γ[y] = some τh₁:¬x = y⊢ <{ Γ / δ ⊢ ~(if x = y then v else STLCRef.Tm.var y) ⦂ τ }>neg.h δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>y:StringΓ:Contextτ:Tyh:(x →ₚ τ₁ ; Γ)[y] = some τh₁:¬x = y⊢ x ≠ y <;> neg δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>y:StringΓ:Contextτ:Tyh:Γ[y] = some τh₁:¬x = y⊢ <{ Γ / δ ⊢ ~(if x = y then v else STLCRef.Tm.var y) ⦂ τ }>neg.h δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>y:StringΓ:Contextτ:Tyh:(x →ₚ τ₁ ; Γ)[y] = some τh₁:¬x = y⊢ x ≠ y simp_all All goals completed! 🐙
apply_rules using StlcRefTyping All goals completed! 🐙
| abs y _ _ ih => abs δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>y:Stringa✝¹:Tya✝:Tmih:∀ (Γ : Context) (τ : Ty), <{ ~(x →ₚ τ₁ ; Γ) / δ ⊢ a✝ ⦂ τ }> → <{ Γ / δ ⊢ [~x := v] a✝ ⦂ τ }>Γ:Contextτ:Tyht:<{ ~(x →ₚ τ₁ ; Γ) / δ ⊢ λ ~y : a✝¹ . a✝ ⦂ τ }>⊢ <{ Γ / δ ⊢ ~(if x = y then <{ λ ~y : a✝¹ . a✝ }> else <{ λ ~y : a✝¹ . [~x := v] a✝ }>) ⦂ τ }>
inversion ht with | _ h => abs δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>y:Stringa✝¹:Tya✝:Tmih:∀ (Γ : Context) (τ : Ty), <{ ~(x →ₚ τ₁ ; Γ) / δ ⊢ a✝ ⦂ τ }> → <{ Γ / δ ⊢ [~x := v] a✝ ⦂ τ }>Γ:Contextτ₁✝:Tyh:<{ ~(y →ₚ a✝¹ ; x →ₚ τ₁ ; Γ) / δ ⊢ a✝ ⦂ τ₁✝ }>⊢ <{ Γ / δ ⊢ ~(if x = y then <{ λ ~y : a✝¹ . a✝ }> else <{ λ ~y : a✝¹ . [~x := v] a✝ }>) ⦂ a✝¹ → τ₁✝ }>
by_cases h₁ : x = y pos δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>y:Stringa✝¹:Tya✝:Tmih:∀ (Γ : Context) (τ : Ty), <{ ~(x →ₚ τ₁ ; Γ) / δ ⊢ a✝ ⦂ τ }> → <{ Γ / δ ⊢ [~x := v] a✝ ⦂ τ }>Γ:Contextτ₁✝:Tyh:<{ ~(y →ₚ a✝¹ ; x →ₚ τ₁ ; Γ) / δ ⊢ a✝ ⦂ τ₁✝ }>h₁:x = y⊢ <{ Γ / δ ⊢ ~(if x = y then <{ λ ~y : a✝¹ . a✝ }> else <{ λ ~y : a✝¹ . [~x := v] a✝ }>) ⦂ a✝¹ → τ₁✝ }>neg δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>y:Stringa✝¹:Tya✝:Tmih:∀ (Γ : Context) (τ : Ty), <{ ~(x →ₚ τ₁ ; Γ) / δ ⊢ a✝ ⦂ τ }> → <{ Γ / δ ⊢ [~x := v] a✝ ⦂ τ }>Γ:Contextτ₁✝:Tyh:<{ ~(y →ₚ a✝¹ ; x →ₚ τ₁ ; Γ) / δ ⊢ a✝ ⦂ τ₁✝ }>h₁:¬x = y⊢ <{ Γ / δ ⊢ ~(if x = y then <{ λ ~y : a✝¹ . a✝ }> else <{ λ ~y : a✝¹ . [~x := v] a✝ }>) ⦂ a✝¹ → τ₁✝ }>
· pos δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>y:Stringa✝¹:Tya✝:Tmih:∀ (Γ : Context) (τ : Ty), <{ ~(x →ₚ τ₁ ; Γ) / δ ⊢ a✝ ⦂ τ }> → <{ Γ / δ ⊢ [~x := v] a✝ ⦂ τ }>Γ:Contextτ₁✝:Tyh:<{ ~(y →ₚ a✝¹ ; x →ₚ τ₁ ; Γ) / δ ⊢ a✝ ⦂ τ₁✝ }>h₁:x = y⊢ <{ Γ / δ ⊢ ~(if x = y then <{ λ ~y : a✝¹ . a✝ }> else <{ λ ~y : a✝¹ . [~x := v] a✝ }>) ⦂ a✝¹ → τ₁✝ }> simp_all [PartialMap.update_shadow] pos δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>y:Stringa✝¹:Tya✝:TmΓ:Contextτ₁✝:Tyih:∀ (Γ : Context) (τ : Ty), <{ ~(y →ₚ τ₁ ; Γ) / δ ⊢ a✝ ⦂ τ }> → <{ Γ / δ ⊢ [~y := v] a✝ ⦂ τ }>h:<{ ~(y →ₚ a✝¹ ; Γ) / δ ⊢ a✝ ⦂ τ₁✝ }>h₁:x = y⊢ <{ Γ / δ ⊢ λ ~y : a✝¹ . a✝ ⦂ a✝¹ → τ₁✝ }>; apply_rules using StlcRefTyping All goals completed! 🐙
· neg δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>y:Stringa✝¹:Tya✝:Tmih:∀ (Γ : Context) (τ : Ty), <{ ~(x →ₚ τ₁ ; Γ) / δ ⊢ a✝ ⦂ τ }> → <{ Γ / δ ⊢ [~x := v] a✝ ⦂ τ }>Γ:Contextτ₁✝:Tyh:<{ ~(y →ₚ a✝¹ ; x →ₚ τ₁ ; Γ) / δ ⊢ a✝ ⦂ τ₁✝ }>h₁:¬x = y⊢ <{ Γ / δ ⊢ ~(if x = y then <{ λ ~y : a✝¹ . a✝ }> else <{ λ ~y : a✝¹ . [~x := v] a✝ }>) ⦂ a✝¹ → τ₁✝ }> rw [PartialMap.update_permute neg δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>y:Stringa✝¹:Tya✝:Tmih:∀ (Γ : Context) (τ : Ty), <{ ~(x →ₚ τ₁ ; Γ) / δ ⊢ a✝ ⦂ τ }> → <{ Γ / δ ⊢ [~x := v] a✝ ⦂ τ }>Γ:Contextτ₁✝:Tyh:<{ ~(x →ₚ τ₁ ; y →ₚ a✝¹ ; Γ) / δ ⊢ a✝ ⦂ τ₁✝ }>h₁:¬x = y⊢ <{ Γ / δ ⊢ ~(if x = y then <{ λ ~y : a✝¹ . a✝ }> else <{ λ ~y : a✝¹ . [~x := v] a✝ }>) ⦂ a✝¹ → τ₁✝ }>neg δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>y:Stringa✝¹:Tya✝:Tmih:∀ (Γ : Context) (τ : Ty), <{ ~(x →ₚ τ₁ ; Γ) / δ ⊢ a✝ ⦂ τ }> → <{ Γ / δ ⊢ [~x := v] a✝ ⦂ τ }>Γ:Contextτ₁✝:Tyh:<{ ~(y →ₚ a✝¹ ; x →ₚ τ₁ ; Γ) / δ ⊢ a✝ ⦂ τ₁✝ }>h₁:¬x = y⊢ y ≠ x] at h neg δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>y:Stringa✝¹:Tya✝:Tmih:∀ (Γ : Context) (τ : Ty), <{ ~(x →ₚ τ₁ ; Γ) / δ ⊢ a✝ ⦂ τ }> → <{ Γ / δ ⊢ [~x := v] a✝ ⦂ τ }>Γ:Contextτ₁✝:Tyh:<{ ~(x →ₚ τ₁ ; y →ₚ a✝¹ ; Γ) / δ ⊢ a✝ ⦂ τ₁✝ }>h₁:¬x = y⊢ <{ Γ / δ ⊢ ~(if x = y then <{ λ ~y : a✝¹ . a✝ }> else <{ λ ~y : a✝¹ . [~x := v] a✝ }>) ⦂ a✝¹ → τ₁✝ }>neg δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>y:Stringa✝¹:Tya✝:Tmih:∀ (Γ : Context) (τ : Ty), <{ ~(x →ₚ τ₁ ; Γ) / δ ⊢ a✝ ⦂ τ }> → <{ Γ / δ ⊢ [~x := v] a✝ ⦂ τ }>Γ:Contextτ₁✝:Tyh:<{ ~(y →ₚ a✝¹ ; x →ₚ τ₁ ; Γ) / δ ⊢ a✝ ⦂ τ₁✝ }>h₁:¬x = y⊢ y ≠ x
· neg δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>y:Stringa✝¹:Tya✝:Tmih:∀ (Γ : Context) (τ : Ty), <{ ~(x →ₚ τ₁ ; Γ) / δ ⊢ a✝ ⦂ τ }> → <{ Γ / δ ⊢ [~x := v] a✝ ⦂ τ }>Γ:Contextτ₁✝:Tyh:<{ ~(x →ₚ τ₁ ; y →ₚ a✝¹ ; Γ) / δ ⊢ a✝ ⦂ τ₁✝ }>h₁:¬x = y⊢ <{ Γ / δ ⊢ ~(if x = y then <{ λ ~y : a✝¹ . a✝ }> else <{ λ ~y : a✝¹ . [~x := v] a✝ }>) ⦂ a✝¹ → τ₁✝ }> simp_all neg δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>y:Stringa✝¹:Tya✝:Tmih:∀ (Γ : Context) (τ : Ty), <{ ~(x →ₚ τ₁ ; Γ) / δ ⊢ a✝ ⦂ τ }> → <{ Γ / δ ⊢ [~x := v] a✝ ⦂ τ }>Γ:Contextτ₁✝:Tyh:<{ ~(x →ₚ τ₁ ; y →ₚ a✝¹ ; Γ) / δ ⊢ a✝ ⦂ τ₁✝ }>h₁:¬x = y⊢ <{ Γ / δ ⊢ λ ~y : a✝¹ . [~x := v] a✝ ⦂ a✝¹ → τ₁✝ }>; apply_rules using StlcRefTyping All goals completed! 🐙
· neg δ:StoreTyx:Stringτ₁:Tyv:Tmhv:<{ ∅ / δ ⊢ v ⦂ τ₁ }>y:Stringa✝¹:Tya✝:Tmih:∀ (Γ : Context) (τ : Ty), <{ ~(x →ₚ τ₁ ; Γ) / δ ⊢ a✝ ⦂ τ }> → <{ Γ / δ ⊢ [~x := v] a✝ ⦂ τ }>Γ:Contextτ₁✝:Tyh:<{ ~(y →ₚ a✝¹ ; x →ₚ τ₁ ; Γ) / δ ⊢ a✝ ⦂ τ₁✝ }>h₁:¬x = y⊢ y ≠ x lia All goals completed! 🐙
9.5.4.2. Assignment Preserves Store Typing
Next, we must show that replacing the contents of a cell in the
store with a new value of appropriate type does not change the
overall type of the store. (This is needed for the assign
rule.)
theorem assign_pres_store_typing {δ : StoreTy} {ρ : Store} {l : Nat} {t : Tm}
(hLen : l < ρ.length)
(hStoreTy : δ ⊢ ρ)
(hTy : <{ ∅ / δ ⊢ t ⦂ ~(δ[l]) }>) :
δ ⊢ ρ.set l t := by δ:StoreTyρ:Storel:Natt:TmhLen:l < List.length ρhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t ⦂ ~δ[l] }>⊢ δ ⊢ List.set ρ l t
have ⟨h₁, h₂⟩ := hStoreTy δ:StoreTyρ:Storel:Natt:TmhLen:l < List.length ρhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t ⦂ ~δ[l] }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>⊢ δ ⊢ List.set ρ l t
constructor left δ:StoreTyρ:Storel:Natt:TmhLen:l < List.length ρhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t ⦂ ~δ[l] }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>⊢ List.length δ = (List.set ρ l t).lengthright δ:StoreTyρ:Storel:Natt:TmhLen:l < List.length ρhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t ⦂ ~δ[l] }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>⊢ ∀ (l_1 : Nat), l_1 < (List.set ρ l t).length → <{ ∅ / δ ⊢ ~(List.set ρ l t)[l_1] ⦂ ~δ[l_1] }>
· left δ:StoreTyρ:Storel:Natt:TmhLen:l < List.length ρhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t ⦂ ~δ[l] }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>⊢ List.length δ = (List.set ρ l t).length simp_all [List.length_set] All goals completed! 🐙
· right δ:StoreTyρ:Storel:Natt:TmhLen:l < List.length ρhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t ⦂ ~δ[l] }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>⊢ ∀ (l_1 : Nat), l_1 < (List.set ρ l t).length → <{ ∅ / δ ⊢ ~(List.set ρ l t)[l_1] ⦂ ~δ[l_1] }> intro l' hLen' right δ:StoreTyρ:Storel:Natt:TmhLen:l < List.length ρhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t ⦂ ~δ[l] }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>l':NathLen':l' < (List.set ρ l t).length⊢ <{ ∅ / δ ⊢ ~(List.set ρ l t)[l'] ⦂ ~δ[l'] }>
by_cases h₁ : l' = l pos δ:StoreTyρ:Storel:Natt:TmhLen:l < List.length ρhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t ⦂ ~δ[l] }>h₁✝:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>l':NathLen':l' < (List.set ρ l t).lengthh₁:l' = l⊢ <{ ∅ / δ ⊢ ~(List.set ρ l t)[l'] ⦂ ~δ[l'] }>neg δ:StoreTyρ:Storel:Natt:TmhLen:l < List.length ρhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t ⦂ ~δ[l] }>h₁✝:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>l':NathLen':l' < (List.set ρ l t).lengthh₁:¬l' = l⊢ <{ ∅ / δ ⊢ ~(List.set ρ l t)[l'] ⦂ ~δ[l'] }>
· pos δ:StoreTyρ:Storel:Natt:TmhLen:l < List.length ρhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t ⦂ ~δ[l] }>h₁✝:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>l':NathLen':l' < (List.set ρ l t).lengthh₁:l' = l⊢ <{ ∅ / δ ⊢ ~(List.set ρ l t)[l'] ⦂ ~δ[l'] }> subst_vars pos δ:StoreTyρ:Storet:TmhStoreTy:δ ⊢ ρh₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>l':NathLen:l' < List.length ρhTy:<{ ∅ / δ ⊢ t ⦂ ~δ[l'] }>hLen':l' < (List.set ρ l' t).length⊢ <{ ∅ / δ ⊢ ~(List.set ρ l' t)[l'] ⦂ ~δ[l'] }>
rw [Store_get_set_eq pos δ:StoreTyρ:Storet:TmhStoreTy:δ ⊢ ρh₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>l':NathLen:l' < List.length ρhTy:<{ ∅ / δ ⊢ t ⦂ ~δ[l'] }>hLen':l' < (List.set ρ l' t).length⊢ <{ ∅ / δ ⊢ t ⦂ ~δ[l'] }>pos.h δ:StoreTyρ:Storet:TmhStoreTy:δ ⊢ ρh₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>l':NathLen:l' < List.length ρhTy:<{ ∅ / δ ⊢ t ⦂ ~δ[l'] }>hLen':l' < (List.set ρ l' t).length⊢ l' < List.length ρ] pos δ:StoreTyρ:Storet:TmhStoreTy:δ ⊢ ρh₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>l':NathLen:l' < List.length ρhTy:<{ ∅ / δ ⊢ t ⦂ ~δ[l'] }>hLen':l' < (List.set ρ l' t).length⊢ <{ ∅ / δ ⊢ t ⦂ ~δ[l'] }>pos.h δ:StoreTyρ:Storet:TmhStoreTy:δ ⊢ ρh₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>l':NathLen:l' < List.length ρhTy:<{ ∅ / δ ⊢ t ⦂ ~δ[l'] }>hLen':l' < (List.set ρ l' t).length⊢ l' < List.length ρ <;> pos δ:StoreTyρ:Storet:TmhStoreTy:δ ⊢ ρh₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>l':NathLen:l' < List.length ρhTy:<{ ∅ / δ ⊢ t ⦂ ~δ[l'] }>hLen':l' < (List.set ρ l' t).length⊢ <{ ∅ / δ ⊢ t ⦂ ~δ[l'] }>pos.h δ:StoreTyρ:Storet:TmhStoreTy:δ ⊢ ρh₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>l':NathLen:l' < List.length ρhTy:<{ ∅ / δ ⊢ t ⦂ ~δ[l'] }>hLen':l' < (List.set ρ l' t).length⊢ l' < List.length ρ assumption All goals completed! 🐙
· neg δ:StoreTyρ:Storel:Natt:TmhLen:l < List.length ρhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t ⦂ ~δ[l] }>h₁✝:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>l':NathLen':l' < (List.set ρ l t).lengthh₁:¬l' = l⊢ <{ ∅ / δ ⊢ ~(List.set ρ l t)[l'] ⦂ ~δ[l'] }> rw [Store_get_set_neq neg δ:StoreTyρ:Storel:Natt:TmhLen:l < List.length ρhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t ⦂ ~δ[l] }>h₁✝:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>l':NathLen':l' < (List.set ρ l t).lengthh₁:¬l' = l⊢ <{ ∅ / δ ⊢ ~ρ[l'] ⦂ ~δ[l'] }>neg.a δ:StoreTyρ:Storel:Natt:TmhLen:l < List.length ρhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t ⦂ ~δ[l] }>h₁✝:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>l':NathLen':l' < (List.set ρ l t).lengthh₁:¬l' = l⊢ l' ≠ l] neg δ:StoreTyρ:Storel:Natt:TmhLen:l < List.length ρhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t ⦂ ~δ[l] }>h₁✝:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>l':NathLen':l' < (List.set ρ l t).lengthh₁:¬l' = l⊢ <{ ∅ / δ ⊢ ~ρ[l'] ⦂ ~δ[l'] }>neg.a δ:StoreTyρ:Storel:Natt:TmhLen:l < List.length ρhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t ⦂ ~δ[l] }>h₁✝:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>l':NathLen':l' < (List.set ρ l t).lengthh₁:¬l' = l⊢ l' ≠ l <;> neg δ:StoreTyρ:Storel:Natt:TmhLen:l < List.length ρhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t ⦂ ~δ[l] }>h₁✝:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>l':NathLen':l' < (List.set ρ l t).lengthh₁:¬l' = l⊢ <{ ∅ / δ ⊢ ~ρ[l'] ⦂ ~δ[l'] }>neg.a δ:StoreTyρ:Storel:Natt:TmhLen:l < List.length ρhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t ⦂ ~δ[l] }>h₁✝:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>l':NathLen':l' < (List.set ρ l t).lengthh₁:¬l' = l⊢ l' ≠ l try assumption All goals completed! 🐙
apply h₂ neg δ:StoreTyρ:Storel:Natt:TmhLen:l < List.length ρhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t ⦂ ~δ[l] }>h₁✝:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>l':NathLen':l' < (List.set ρ l t).lengthh₁:¬l' = l⊢ l' < List.length ρ
simp_all [List.length_set] All goals completed! 🐙
9.5.4.3. Weakening for Stores
Finally, we need a lemma on store typings, stating that, if a store typing is extended with a new location, the extended one still allows us to assign the same types to the same terms as the original.
theorem store_weakening {Γ : Context} {δ δ' : StoreTy} {t : Tm} {τ : Ty}
(hExt : Extends δ' δ)
(hTy : <{ Γ / δ ⊢ t ⦂ τ }>) :
<{ Γ / δ' ⊢ t ⦂ τ }> := by Γ:Contextδ:StoreTyδ':StoreTyt:Tmτ:TyhExt:Extends δ' δhTy:<{ Γ / δ ⊢ t ⦂ τ }>⊢ <{ Γ / δ' ⊢ t ⦂ τ }>
induction hTy with (try (apply_rules using StlcRefTyping All goals completed! 🐙; done))
| loc_ h => loc_ Γ:Contextδ:StoreTyδ':StoreTyt:Tmτ:TyhExt:Extends δ' δΓ✝:Contextl✝:Nath:l✝ < List.length δ⊢ <{ Γ✝ / δ' ⊢ ~(Tm.loc l✝) ⦂ Ref ~δ[l✝] }>
rw [←extends_lookup loc_ Γ:Contextδ:StoreTyδ':StoreTyt:Tmτ:TyhExt:Extends δ' δΓ✝:Contextl✝:Nath:l✝ < List.length δ⊢ <{ Γ✝ / δ' ⊢ ~(Tm.loc l✝) ⦂ Ref ~?m.40[l✝] }>loc_.h₁ Γ:Contextδ:StoreTyδ':StoreTyt:Tmτ:TyhExt:Extends δ' δΓ✝:Contextl✝:Nath:l✝ < List.length δ⊢ l✝ < List.length δloc_.h₂ Γ:Contextδ:StoreTyδ':StoreTyt:Tmτ:TyhExt:Extends δ' δΓ✝:Contextl✝:Nath:l✝ < List.length δ⊢ Extends ?m.40 δΓ:Contextδ:StoreTyδ':StoreTyt:Tmτ:TyhExt:Extends δ' δΓ✝:Contextl✝:Nath:l✝ < List.length δ⊢ StoreTy] loc_ Γ:Contextδ:StoreTyδ':StoreTyt:Tmτ:TyhExt:Extends δ' δΓ✝:Contextl✝:Nath:l✝ < List.length δ⊢ <{ Γ✝ / δ' ⊢ ~(Tm.loc l✝) ⦂ Ref ~?m.40[l✝] }>loc_.h₁ Γ:Contextδ:StoreTyδ':StoreTyt:Tmτ:TyhExt:Extends δ' δΓ✝:Contextl✝:Nath:l✝ < List.length δ⊢ l✝ < List.length δloc_.h₂ Γ:Contextδ:StoreTyδ':StoreTyt:Tmτ:TyhExt:Extends δ' δΓ✝:Contextl✝:Nath:l✝ < List.length δ⊢ Extends ?m.40 δΓ:Contextδ:StoreTyδ':StoreTyt:Tmτ:TyhExt:Extends δ' δΓ✝:Contextl✝:Nath:l✝ < List.length δ⊢ StoreTy <;> loc_ Γ:Contextδ:StoreTyδ':StoreTyt:Tmτ:TyhExt:Extends δ' δΓ✝:Contextl✝:Nath:l✝ < List.length δ⊢ <{ Γ✝ / δ' ⊢ ~(Tm.loc l✝) ⦂ Ref ~?m.40[l✝] }>loc_.h₁ Γ:Contextδ:StoreTyδ':StoreTyt:Tmτ:TyhExt:Extends δ' δΓ✝:Contextl✝:Nath:l✝ < List.length δ⊢ l✝ < List.length δloc_.h₂ Γ:Contextδ:StoreTyδ':StoreTyt:Tmτ:TyhExt:Extends δ' δΓ✝:Contextl✝:Nath:l✝ < List.length δ⊢ Extends ?m.40 δΓ:Contextδ:StoreTyδ':StoreTyt:Tmτ:TyhExt:Extends δ' δΓ✝:Contextl✝:Nath:l✝ < List.length δ⊢ StoreTy try assumption All goals completed! 🐙
apply HasType.loc_ loc_ Γ:Contextδ:StoreTyδ':StoreTyt:Tmτ:TyhExt:Extends δ' δΓ✝:Contextl✝:Nath:l✝ < List.length δ⊢ l✝ < List.length δ'
apply length_extends loc_.h₁ Γ:Contextδ:StoreTyδ':StoreTyt:Tmτ:TyhExt:Extends δ' δΓ✝:Contextl✝:Nath:l✝ < List.length δ⊢ l✝ < List.length ?loc_.δloc_.h₂ Γ:Contextδ:StoreTyδ':StoreTyt:Tmτ:TyhExt:Extends δ' δΓ✝:Contextl✝:Nath:l✝ < List.length δ⊢ Extends δ' ?loc_.δloc_.δ Γ:Contextδ:StoreTyδ':StoreTyt:Tmτ:TyhExt:Extends δ' δΓ✝:Contextl✝:Nath:l✝ < List.length δ⊢ StoreTy <;> loc_.h₁ Γ:Contextδ:StoreTyδ':StoreTyt:Tmτ:TyhExt:Extends δ' δΓ✝:Contextl✝:Nath:l✝ < List.length δ⊢ l✝ < List.length ?loc_.δloc_.h₂ Γ:Contextδ:StoreTyδ':StoreTyt:Tmτ:TyhExt:Extends δ' δΓ✝:Contextl✝:Nath:l✝ < List.length δ⊢ Extends δ' ?loc_.δloc_.δ Γ:Contextδ:StoreTyδ':StoreTyt:Tmτ:TyhExt:Extends δ' δΓ✝:Contextl✝:Nath:l✝ < List.length δ⊢ StoreTy assumption All goals completed! 🐙
We can use the store_weakening lemma to prove that if a store is
well typed with respect to a store typing, then the store extended
with a new term τ will still be well typed with respect to the
store typing extended with τ's type.
theorem store_well_typed_app {δ : StoreTy} {ρ : Store} {t₁ : Tm} {τ₁ : Ty}
(hStoreTy : δ ⊢ ρ)
(hTy : <{ ∅ / δ ⊢ t₁ ⦂ τ₁ }>) :
(δ.concat τ₁) ⊢ (ρ.concat t₁) := by δ:StoreTyρ:Storet₁:Tmτ₁:TyhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t₁ ⦂ τ₁ }>⊢ List.concat δ τ₁ ⊢ List.concat ρ t₁
have ⟨h₁, h₂⟩ := hStoreTy δ:StoreTyρ:Storet₁:Tmτ₁:TyhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t₁ ⦂ τ₁ }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>⊢ List.concat δ τ₁ ⊢ List.concat ρ t₁
simp_all only [List.concat_eq_append] δ:StoreTyρ:Storet₁:Tmτ₁:TyhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t₁ ⦂ τ₁ }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>⊢ δ ++ [τ₁] ⊢ ρ ++ [t₁]
constructor left δ:StoreTyρ:Storet₁:Tmτ₁:TyhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t₁ ⦂ τ₁ }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>⊢ (δ ++ [τ₁]).length = (ρ ++ [t₁]).lengthright δ:StoreTyρ:Storet₁:Tmτ₁:TyhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t₁ ⦂ τ₁ }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>⊢ ∀ (l : Nat), l < (ρ ++ [t₁]).length → <{ ∅ / (δ ++ [τ₁]) ⊢ ~(ρ ++ [t₁])[l] ⦂ ~(δ ++ [τ₁])[l] }>
· left δ:StoreTyρ:Storet₁:Tmτ₁:TyhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t₁ ⦂ τ₁ }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>⊢ (δ ++ [τ₁]).length = (ρ ++ [t₁]).length simp_all All goals completed! 🐙
· right δ:StoreTyρ:Storet₁:Tmτ₁:TyhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t₁ ⦂ τ₁ }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>⊢ ∀ (l : Nat), l < (ρ ++ [t₁]).length → <{ ∅ / (δ ++ [τ₁]) ⊢ ~(ρ ++ [t₁])[l] ⦂ ~(δ ++ [τ₁])[l] }> simp_all only [List.length_append, List.length_cons, List.length_nil, Nat.zero_add] right δ:StoreTyρ:Storet₁:Tmτ₁:TyhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t₁ ⦂ τ₁ }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>⊢ ∀ (l : Nat), l < List.length ρ + 1 → <{ ∅ / (δ ++ [τ₁]) ⊢ ~(ρ ++ [t₁])[l] ⦂ ~(δ ++ [τ₁])[l] }>
intro l hl right δ:StoreTyρ:Storet₁:Tmτ₁:TyhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t₁ ⦂ τ₁ }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>l:Nathl:l < List.length ρ + 1⊢ <{ ∅ / (δ ++ [τ₁]) ⊢ ~(ρ ++ [t₁])[l] ⦂ ~(δ ++ [τ₁])[l] }>
inversion hl with
| refl => refl δ:StoreTyρ:Storet₁:Tmτ₁:TyhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t₁ ⦂ τ₁ }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>⊢ <{ ∅ / (δ ++ [τ₁]) ⊢ ~(ρ ++ [t₁])[List.length ρ] ⦂ ~(δ ++ [τ₁])[List.length ρ] }>
apply store_weakening refl.hExt δ:StoreTyρ:Storet₁:Tmτ₁:TyhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t₁ ⦂ τ₁ }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>⊢ Extends (δ ++ [τ₁]) ?refl.δrefl.hTy δ:StoreTyρ:Storet₁:Tmτ₁:TyhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t₁ ⦂ τ₁ }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>⊢ <{ ∅ / ?refl.δ ⊢ ~(ρ ++ [t₁])[List.length ρ] ⦂ ~(δ ++ [τ₁])[List.length ρ] }>refl.δ δ:StoreTyρ:Storet₁:Tmτ₁:TyhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t₁ ⦂ τ₁ }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>⊢ StoreTy <;> refl.hExt δ:StoreTyρ:Storet₁:Tmτ₁:TyhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t₁ ⦂ τ₁ }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>⊢ Extends (δ ++ [τ₁]) ?refl.δrefl.hTy δ:StoreTyρ:Storet₁:Tmτ₁:TyhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t₁ ⦂ τ₁ }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>⊢ <{ ∅ / ?refl.δ ⊢ ~(ρ ++ [t₁])[List.length ρ] ⦂ ~(δ ++ [τ₁])[List.length ρ] }>refl.δ δ:StoreTyρ:Storet₁:Tmτ₁:TyhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t₁ ⦂ τ₁ }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>⊢ StoreTy try assumption All goals completed! 🐙
apply extends_app refl.hTy δ:StoreTyρ:Storet₁:Tmτ₁:TyhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t₁ ⦂ τ₁ }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>⊢ <{ ∅ / δ ⊢ ~(ρ ++ [t₁])[List.length ρ] ⦂ ~(δ ++ [τ₁])[List.length ρ] }>
simp_all [MyGetElem.getElem] All goals completed! 🐙
| step hl => step δ:StoreTyρ:Storet₁:Tmτ₁:TyhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t₁ ⦂ τ₁ }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>l:Nathl:l.succ.le (List.length ρ)⊢ <{ ∅ / (δ ++ [τ₁]) ⊢ ~(ρ ++ [t₁])[l] ⦂ ~(δ ++ [τ₁])[l] }>
apply store_weakening step.hExt δ:StoreTyρ:Storet₁:Tmτ₁:TyhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t₁ ⦂ τ₁ }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>l:Nathl:l.succ.le (List.length ρ)⊢ Extends (δ ++ [τ₁]) ?step.δstep.hTy δ:StoreTyρ:Storet₁:Tmτ₁:TyhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t₁ ⦂ τ₁ }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>l:Nathl:l.succ.le (List.length ρ)⊢ <{ ∅ / ?step.δ ⊢ ~(ρ ++ [t₁])[l] ⦂ ~(δ ++ [τ₁])[l] }>step.δ δ:StoreTyρ:Storet₁:Tmτ₁:TyhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t₁ ⦂ τ₁ }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>l:Nathl:l.succ.le (List.length ρ)⊢ StoreTy <;> step.hExt δ:StoreTyρ:Storet₁:Tmτ₁:TyhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t₁ ⦂ τ₁ }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>l:Nathl:l.succ.le (List.length ρ)⊢ Extends (δ ++ [τ₁]) ?step.δstep.hTy δ:StoreTyρ:Storet₁:Tmτ₁:TyhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t₁ ⦂ τ₁ }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>l:Nathl:l.succ.le (List.length ρ)⊢ <{ ∅ / ?step.δ ⊢ ~(ρ ++ [t₁])[l] ⦂ ~(δ ++ [τ₁])[l] }>step.δ δ:StoreTyρ:Storet₁:Tmτ₁:TyhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t₁ ⦂ τ₁ }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>l:Nathl:l.succ.le (List.length ρ)⊢ StoreTy try assumption All goals completed! 🐙
· step.hExt δ:StoreTyρ:Storet₁:Tmτ₁:TyhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t₁ ⦂ τ₁ }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>l:Nathl:l.succ.le (List.length ρ)⊢ Extends (δ ++ [τ₁]) δ apply extends_app All goals completed! 🐙
· step.hTy δ:StoreTyρ:Storet₁:Tmτ₁:TyhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t₁ ⦂ τ₁ }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>l:Nathl:l.succ.le (List.length ρ)⊢ <{ ∅ / δ ⊢ ~(ρ ++ [t₁])[l] ⦂ ~(δ ++ [τ₁])[l] }> have hl' : l < ρ.length := by δ:StoreTyρ:Storet₁:Tmτ₁:TyhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t₁ ⦂ τ₁ }>⊢ List.concat δ τ₁ ⊢ List.concat ρ t₁ lia step.hTy δ:StoreTyρ:Storet₁:Tmτ₁:TyhStoreTy:δ ⊢ ρhTy:<{ ∅ / δ ⊢ t₁ ⦂ τ₁ }>h₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>l:Nathl:l.succ.le (List.length ρ)hl':l < List.length ρ⊢ <{ ∅ / δ ⊢ ~(ρ ++ [t₁])[l] ⦂ ~(δ ++ [τ₁])[l] }>
simp_all [MyGetElem.getElem, List.getElem?_append_left] All goals completed! 🐙
9.5.4.4. The Proof!
Now that we've got everything set up right, the proof of
preservation is actually quite straightforward. Where progress's
deref and assign cases only needed a location to exist in
the store, these cases of preservation need to know that its
contents actually have the type δ claims for it.
theorem preservation {δ : StoreTy} {t t' : Tm} {τ : Ty} {ρ ρ' : Store}
(hTy : <{ ∅ / δ ⊢ t ⦂ τ }>)
(hStoreTy : δ ⊢ ρ)
(hEval : t / ρ ⟶ t' / ρ') :
∃ δ', Extends δ' δ ∧ (<{ ∅ / δ' ⊢ t' ⦂ τ }>) ∧ (δ' ⊢ ρ') := by δ:StoreTyt:Tmt':Tmτ:Tyρ:Storeρ':StorehTy:<{ ∅ / δ ⊢ t ⦂ τ }>hStoreTy:δ ⊢ ρhEval:t / ρ ⟶ t' / ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ }> ∧ δ' ⊢ ρ'
generalize heq : (∅ : Context) = Γ at hTy δ:StoreTyt:Tmt':Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρhEval:t / ρ ⟶ t' / ρ'Γ:Contextheq:∅ = ΓhTy:<{ Γ / δ ⊢ t ⦂ τ }>⊢ ∃ δ', Extends δ' δ ∧ <{ Γ / δ' ⊢ t' ⦂ τ }> ∧ δ' ⊢ ρ'
-- discharge the goals where `t` doesn't step
induction hTy generalizing t' with (subst_vars loc_ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextl✝:Nath✝:l✝ < List.length δt':TmhEval:Tm.loc l✝ / ρ ⟶ t' / ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref ~δ[l✝] }> ∧ δ' ⊢ ρ'; try (inversion hEval All goals completed! 🐙; done All goals completed! 🐙))
| app h₁ h₂ ih₁ ih₂ => app δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmt':TmhEval:<{ t₁✝ t₂✝ }> / ρ ⟶ t' / ρ'h₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ → τ₁✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁✝ }> ∧ δ' ⊢ ρ'
inversion hEval with
| appAbs => appAbs δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextτ₁✝:Tyτ₂✝¹:Tyt₂✝:Tmh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>x✝:Stringτ₂✝:Tyt₁✝:Tmh₁:<{ ∅ / δ ⊢ λ ~x✝ : τ₂✝ . t₁✝ ⦂ τ₂✝¹ → τ₁✝ }>h✝:t₂✝.IsValueih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝¹ }> ∧ δ' ⊢ ρih₁:∀ {t' : Tm}, <{ λ ~x✝ : τ₂✝ . t₁✝ }> / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝¹ → τ₁✝ }> ∧ δ' ⊢ ρ⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ [~x✝ := t₂✝] t₁✝ ⦂ τ₁✝ }> ∧ δ' ⊢ ρ
inversion h₁ with | abs h => abs δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextτ₁✝:Tyτ₂✝:Tyt₂✝:Tmh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>x✝:Stringt₁✝:Tmh✝:t₂✝.IsValueih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝¹ }> ∧ δ' ⊢ ρih₁:∀ {t' : Tm}, <{ λ ~x✝ : τ₂✝ . t₁✝ }> / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ → τ₁✝ }> ∧ δ' ⊢ ρh:<{ ~(x✝ →ₚ τ₂✝) / δ ⊢ t₁✝ ⦂ τ₁✝ }>⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ [~x✝ := t₂✝] t₁✝ ⦂ τ₁✝ }> ∧ δ' ⊢ ρ
exists δ abs δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextτ₁✝:Tyτ₂✝:Tyt₂✝:Tmh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>x✝:Stringt₁✝:Tmh✝:t₂✝.IsValueih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝¹ }> ∧ δ' ⊢ ρih₁:∀ {t' : Tm}, <{ λ ~x✝ : τ₂✝ . t₁✝ }> / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ → τ₁✝ }> ∧ δ' ⊢ ρh:<{ ~(x✝ →ₚ τ₂✝) / δ ⊢ t₁✝ ⦂ τ₁✝ }>⊢ Extends δ δ ∧ <{ ∅ / δ ⊢ [~x✝ := t₂✝] t₁✝ ⦂ τ₁✝ }> ∧ δ ⊢ ρ; constructor abs.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextτ₁✝:Tyτ₂✝:Tyt₂✝:Tmh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>x✝:Stringt₁✝:Tmh✝:t₂✝.IsValueih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝¹ }> ∧ δ' ⊢ ρih₁:∀ {t' : Tm}, <{ λ ~x✝ : τ₂✝ . t₁✝ }> / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ → τ₁✝ }> ∧ δ' ⊢ ρh:<{ ~(x✝ →ₚ τ₂✝) / δ ⊢ t₁✝ ⦂ τ₁✝ }>⊢ Extends δ δabs.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextτ₁✝:Tyτ₂✝:Tyt₂✝:Tmh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>x✝:Stringt₁✝:Tmh✝:t₂✝.IsValueih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝¹ }> ∧ δ' ⊢ ρih₁:∀ {t' : Tm}, <{ λ ~x✝ : τ₂✝ . t₁✝ }> / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ → τ₁✝ }> ∧ δ' ⊢ ρh:<{ ~(x✝ →ₚ τ₂✝) / δ ⊢ t₁✝ ⦂ τ₁✝ }>⊢ <{ ∅ / δ ⊢ [~x✝ := t₂✝] t₁✝ ⦂ τ₁✝ }> ∧ δ ⊢ ρ
apply extends_refl abs.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextτ₁✝:Tyτ₂✝:Tyt₂✝:Tmh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>x✝:Stringt₁✝:Tmh✝:t₂✝.IsValueih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝¹ }> ∧ δ' ⊢ ρih₁:∀ {t' : Tm}, <{ λ ~x✝ : τ₂✝ . t₁✝ }> / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ → τ₁✝ }> ∧ δ' ⊢ ρh:<{ ~(x✝ →ₚ τ₂✝) / δ ⊢ t₁✝ ⦂ τ₁✝ }>⊢ <{ ∅ / δ ⊢ [~x✝ := t₂✝] t₁✝ ⦂ τ₁✝ }> ∧ δ ⊢ ρ; constructor abs.right.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextτ₁✝:Tyτ₂✝:Tyt₂✝:Tmh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>x✝:Stringt₁✝:Tmh✝:t₂✝.IsValueih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝¹ }> ∧ δ' ⊢ ρih₁:∀ {t' : Tm}, <{ λ ~x✝ : τ₂✝ . t₁✝ }> / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ → τ₁✝ }> ∧ δ' ⊢ ρh:<{ ~(x✝ →ₚ τ₂✝) / δ ⊢ t₁✝ ⦂ τ₁✝ }>⊢ <{ ∅ / δ ⊢ [~x✝ := t₂✝] t₁✝ ⦂ τ₁✝ }>abs.right.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextτ₁✝:Tyτ₂✝:Tyt₂✝:Tmh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>x✝:Stringt₁✝:Tmh✝:t₂✝.IsValueih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝¹ }> ∧ δ' ⊢ ρih₁:∀ {t' : Tm}, <{ λ ~x✝ : τ₂✝ . t₁✝ }> / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ → τ₁✝ }> ∧ δ' ⊢ ρh:<{ ~(x✝ →ₚ τ₂✝) / δ ⊢ t₁✝ ⦂ τ₁✝ }>⊢ δ ⊢ ρ
apply_rules [substitution_preserves_typing, extends_refl] using StlcRefTyping abs.right.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextτ₁✝:Tyτ₂✝:Tyt₂✝:Tmh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>x✝:Stringt₁✝:Tmh✝:t₂✝.IsValueih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝¹ }> ∧ δ' ⊢ ρih₁:∀ {t' : Tm}, <{ λ ~x✝ : τ₂✝ . t₁✝ }> / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ → τ₁✝ }> ∧ δ' ⊢ ρh:<{ ~(x✝ →ₚ τ₂✝) / δ ⊢ t₁✝ ⦂ τ₁✝ }>⊢ δ ⊢ ρ
assumption All goals completed! 🐙
| app₁ hs => app₁ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ → τ₁✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t₁'✝ t₂✝ ⦂ τ₁✝ }> ∧ δ' ⊢ ρ'
have ⟨δ', hExt, hTy', hStoreTy'⟩ := ih₁ hs rfl app₁ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ → τ₁✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ τ₂✝ → τ₁✝ }>hStoreTy':δ' ⊢ ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t₁'✝ t₂✝ ⦂ τ₁✝ }> ∧ δ' ⊢ ρ'
exists δ' app₁ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ → τ₁✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ τ₂✝ → τ₁✝ }>hStoreTy':δ' ⊢ ρ'⊢ Extends δ' δ ∧ <{ ∅ / δ' ⊢ t₁'✝ t₂✝ ⦂ τ₁✝ }> ∧ δ' ⊢ ρ'; constructor app₁.left δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ → τ₁✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ τ₂✝ → τ₁✝ }>hStoreTy':δ' ⊢ ρ'⊢ Extends δ' δapp₁.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ → τ₁✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ τ₂✝ → τ₁✝ }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ t₁'✝ t₂✝ ⦂ τ₁✝ }> ∧ δ' ⊢ ρ'
assumption app₁.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ → τ₁✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ τ₂✝ → τ₁✝ }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ t₁'✝ t₂✝ ⦂ τ₁✝ }> ∧ δ' ⊢ ρ'; constructor app₁.right.left δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ → τ₁✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ τ₂✝ → τ₁✝ }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ t₁'✝ t₂✝ ⦂ τ₁✝ }>app₁.right.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ → τ₁✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ τ₂✝ → τ₁✝ }>hStoreTy':δ' ⊢ ρ'⊢ δ' ⊢ ρ'
solve_by_elim [store_weakening] using StlcRefTyping app₁.right.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ → τ₁✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ τ₂✝ → τ₁✝ }>hStoreTy':δ' ⊢ ρ'⊢ δ' ⊢ ρ'
assumption All goals completed! 🐙
| app₂ _ hs => app₂ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ → τ₁✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₂'✝:Tmh₁✝:t₁✝.IsValuehs:t₂✝ / ρ ⟶ t₂'✝ / ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t₁✝ t₂'✝ ⦂ τ₁✝ }> ∧ δ' ⊢ ρ'
have ⟨δ', hExt, hTy', hStoreTy'⟩ := ih₂ hs rfl app₂ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ → τ₁✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₂'✝:Tmh₁✝:t₁✝.IsValuehs:t₂✝ / ρ ⟶ t₂'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₂'✝ ⦂ τ₂✝ }>hStoreTy':δ' ⊢ ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t₁✝ t₂'✝ ⦂ τ₁✝ }> ∧ δ' ⊢ ρ'
exists δ' app₂ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ → τ₁✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₂'✝:Tmh₁✝:t₁✝.IsValuehs:t₂✝ / ρ ⟶ t₂'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₂'✝ ⦂ τ₂✝ }>hStoreTy':δ' ⊢ ρ'⊢ Extends δ' δ ∧ <{ ∅ / δ' ⊢ t₁✝ t₂'✝ ⦂ τ₁✝ }> ∧ δ' ⊢ ρ'; constructor app₂.left δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ → τ₁✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₂'✝:Tmh₁✝:t₁✝.IsValuehs:t₂✝ / ρ ⟶ t₂'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₂'✝ ⦂ τ₂✝ }>hStoreTy':δ' ⊢ ρ'⊢ Extends δ' δapp₂.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ → τ₁✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₂'✝:Tmh₁✝:t₁✝.IsValuehs:t₂✝ / ρ ⟶ t₂'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₂'✝ ⦂ τ₂✝ }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ t₁✝ t₂'✝ ⦂ τ₁✝ }> ∧ δ' ⊢ ρ'
assumption app₂.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ → τ₁✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₂'✝:Tmh₁✝:t₁✝.IsValuehs:t₂✝ / ρ ⟶ t₂'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₂'✝ ⦂ τ₂✝ }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ t₁✝ t₂'✝ ⦂ τ₁✝ }> ∧ δ' ⊢ ρ'; constructor app₂.right.left δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ → τ₁✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₂'✝:Tmh₁✝:t₁✝.IsValuehs:t₂✝ / ρ ⟶ t₂'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₂'✝ ⦂ τ₂✝ }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ t₁✝ t₂'✝ ⦂ τ₁✝ }>app₂.right.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ → τ₁✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₂'✝:Tmh₁✝:t₁✝.IsValuehs:t₂✝ / ρ ⟶ t₂'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₂'✝ ⦂ τ₂✝ }>hStoreTy':δ' ⊢ ρ'⊢ δ' ⊢ ρ'
solve_by_elim [store_weakening] using StlcRefTyping app₂.right.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextτ₁✝:Tyτ₂✝:Tyt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₂✝ → τ₁✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ → τ₁✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₂'✝:Tmh₁✝:t₁✝.IsValuehs:t₂✝ / ρ ⟶ t₂'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₂'✝ ⦂ τ₂✝ }>hStoreTy':δ' ⊢ ρ'⊢ δ' ⊢ ρ'
assumption All goals completed! 🐙
| succ _ ih => succ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt':TmhEval:<{ succ t₁✝ }> / ρ ⟶ t' / ρ'h✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'
inversion hEval with
| succNat => succNat δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextn✝:Nath✝:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih:∀ {t' : Tm}, Tm.const n✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ ~(Tm.const (n✝ + 1)) ⦂ Nat }> ∧ δ' ⊢ ρ
exists δ succNat δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextn✝:Nath✝:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih:∀ {t' : Tm}, Tm.const n✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ Extends δ δ ∧ <{ ∅ / δ ⊢ ~(Tm.const (n✝ + 1)) ⦂ Nat }> ∧ δ ⊢ ρ; constructor succNat.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextn✝:Nath✝:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih:∀ {t' : Tm}, Tm.const n✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ Extends δ δsuccNat.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextn✝:Nath✝:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih:∀ {t' : Tm}, Tm.const n✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ <{ ∅ / δ ⊢ ~(Tm.const (n✝ + 1)) ⦂ Nat }> ∧ δ ⊢ ρ
apply extends_refl succNat.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextn✝:Nath✝:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih:∀ {t' : Tm}, Tm.const n✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ <{ ∅ / δ ⊢ ~(Tm.const (n✝ + 1)) ⦂ Nat }> ∧ δ ⊢ ρ; constructor succNat.right.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextn✝:Nath✝:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih:∀ {t' : Tm}, Tm.const n✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ <{ ∅ / δ ⊢ ~(Tm.const (n✝ + 1)) ⦂ Nat }>succNat.right.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextn✝:Nath✝:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih:∀ {t' : Tm}, Tm.const n✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ δ ⊢ ρ
constructor succNat.right.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextn✝:Nath✝:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih:∀ {t' : Tm}, Tm.const n✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ δ ⊢ ρ
assumption All goals completed! 🐙
| succ hs => succ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ succ t₁'✝ ⦂ Nat }> ∧ δ' ⊢ ρ'
have ⟨δ', hExt, hTy', hStoreTy'⟩ := ih hs rfl succ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ succ t₁'✝ ⦂ Nat }> ∧ δ' ⊢ ρ'
exists δ' succ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ Extends δ' δ ∧ <{ ∅ / δ' ⊢ succ t₁'✝ ⦂ Nat }> ∧ δ' ⊢ ρ'; constructor succ.left δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ Extends δ' δsucc.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ succ t₁'✝ ⦂ Nat }> ∧ δ' ⊢ ρ'
assumption succ.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ succ t₁'✝ ⦂ Nat }> ∧ δ' ⊢ ρ'; constructor succ.right.left δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ succ t₁'✝ ⦂ Nat }>succ.right.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ δ' ⊢ ρ'
solve_by_elim [store_weakening] using StlcRefTyping succ.right.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ δ' ⊢ ρ'
assumption All goals completed! 🐙
| pred _ ih => pred δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt':TmhEval:<{ pred t₁✝ }> / ρ ⟶ t' / ρ'h✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'
inversion hEval with
| predConst => predConst δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextn✝:Nath✝:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih:∀ {t' : Tm}, Tm.const n✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ ~(Tm.const (n✝ - 1)) ⦂ Nat }> ∧ δ' ⊢ ρ
exists δ predConst δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextn✝:Nath✝:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih:∀ {t' : Tm}, Tm.const n✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ Extends δ δ ∧ <{ ∅ / δ ⊢ ~(Tm.const (n✝ - 1)) ⦂ Nat }> ∧ δ ⊢ ρ; constructor predConst.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextn✝:Nath✝:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih:∀ {t' : Tm}, Tm.const n✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ Extends δ δpredConst.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextn✝:Nath✝:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih:∀ {t' : Tm}, Tm.const n✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ <{ ∅ / δ ⊢ ~(Tm.const (n✝ - 1)) ⦂ Nat }> ∧ δ ⊢ ρ
apply extends_refl predConst.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextn✝:Nath✝:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih:∀ {t' : Tm}, Tm.const n✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ <{ ∅ / δ ⊢ ~(Tm.const (n✝ - 1)) ⦂ Nat }> ∧ δ ⊢ ρ; constructor predConst.right.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextn✝:Nath✝:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih:∀ {t' : Tm}, Tm.const n✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ <{ ∅ / δ ⊢ ~(Tm.const (n✝ - 1)) ⦂ Nat }>predConst.right.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextn✝:Nath✝:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih:∀ {t' : Tm}, Tm.const n✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ δ ⊢ ρ
constructor predConst.right.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextn✝:Nath✝:<{ ∅ / δ ⊢ ~(Tm.const n✝) ⦂ Nat }>ih:∀ {t' : Tm}, Tm.const n✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ δ ⊢ ρ
assumption All goals completed! 🐙
| pred hs => pred δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ pred t₁'✝ ⦂ Nat }> ∧ δ' ⊢ ρ'
have ⟨δ', hExt, hTy', hStoreTy'⟩ := ih hs rfl pred δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ pred t₁'✝ ⦂ Nat }> ∧ δ' ⊢ ρ'
exists δ' pred δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ Extends δ' δ ∧ <{ ∅ / δ' ⊢ pred t₁'✝ ⦂ Nat }> ∧ δ' ⊢ ρ'; constructor pred.left δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ Extends δ' δpred.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ pred t₁'✝ ⦂ Nat }> ∧ δ' ⊢ ρ'
assumption pred.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ pred t₁'✝ ⦂ Nat }> ∧ δ' ⊢ ρ'; constructor pred.right.left δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ pred t₁'✝ ⦂ Nat }>pred.right.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ δ' ⊢ ρ'
solve_by_elim [store_weakening] using StlcRefTyping pred.right.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmh✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ δ' ⊢ ρ'
assumption All goals completed! 🐙
| mult h₁ h₂ ih₁ ih₂ => mult δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmt':TmhEval:<{ t₁✝ * t₂✝ }> / ρ ⟶ t' / ρ'h₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'
inversion hEval with
| multConst => multConst δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextn₁✝:Natn₂✝:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const n₁✝) ⦂ Nat }>h₂:<{ ∅ / δ ⊢ ~(Tm.const n₂✝) ⦂ Nat }>ih₁:∀ {t' : Tm}, Tm.const n₁✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρih₂:∀ {t' : Tm}, Tm.const n₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ ~(Tm.const (n₁✝ * n₂✝)) ⦂ Nat }> ∧ δ' ⊢ ρ
exists δ multConst δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextn₁✝:Natn₂✝:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const n₁✝) ⦂ Nat }>h₂:<{ ∅ / δ ⊢ ~(Tm.const n₂✝) ⦂ Nat }>ih₁:∀ {t' : Tm}, Tm.const n₁✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρih₂:∀ {t' : Tm}, Tm.const n₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ Extends δ δ ∧ <{ ∅ / δ ⊢ ~(Tm.const (n₁✝ * n₂✝)) ⦂ Nat }> ∧ δ ⊢ ρ; constructor multConst.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextn₁✝:Natn₂✝:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const n₁✝) ⦂ Nat }>h₂:<{ ∅ / δ ⊢ ~(Tm.const n₂✝) ⦂ Nat }>ih₁:∀ {t' : Tm}, Tm.const n₁✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρih₂:∀ {t' : Tm}, Tm.const n₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ Extends δ δmultConst.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextn₁✝:Natn₂✝:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const n₁✝) ⦂ Nat }>h₂:<{ ∅ / δ ⊢ ~(Tm.const n₂✝) ⦂ Nat }>ih₁:∀ {t' : Tm}, Tm.const n₁✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρih₂:∀ {t' : Tm}, Tm.const n₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ <{ ∅ / δ ⊢ ~(Tm.const (n₁✝ * n₂✝)) ⦂ Nat }> ∧ δ ⊢ ρ
apply extends_refl multConst.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextn₁✝:Natn₂✝:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const n₁✝) ⦂ Nat }>h₂:<{ ∅ / δ ⊢ ~(Tm.const n₂✝) ⦂ Nat }>ih₁:∀ {t' : Tm}, Tm.const n₁✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρih₂:∀ {t' : Tm}, Tm.const n₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ <{ ∅ / δ ⊢ ~(Tm.const (n₁✝ * n₂✝)) ⦂ Nat }> ∧ δ ⊢ ρ; constructor multConst.right.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextn₁✝:Natn₂✝:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const n₁✝) ⦂ Nat }>h₂:<{ ∅ / δ ⊢ ~(Tm.const n₂✝) ⦂ Nat }>ih₁:∀ {t' : Tm}, Tm.const n₁✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρih₂:∀ {t' : Tm}, Tm.const n₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ <{ ∅ / δ ⊢ ~(Tm.const (n₁✝ * n₂✝)) ⦂ Nat }>multConst.right.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextn₁✝:Natn₂✝:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const n₁✝) ⦂ Nat }>h₂:<{ ∅ / δ ⊢ ~(Tm.const n₂✝) ⦂ Nat }>ih₁:∀ {t' : Tm}, Tm.const n₁✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρih₂:∀ {t' : Tm}, Tm.const n₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ δ ⊢ ρ
constructor multConst.right.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextn₁✝:Natn₂✝:Nath₁:<{ ∅ / δ ⊢ ~(Tm.const n₁✝) ⦂ Nat }>h₂:<{ ∅ / δ ⊢ ~(Tm.const n₂✝) ⦂ Nat }>ih₁:∀ {t' : Tm}, Tm.const n₁✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρih₂:∀ {t' : Tm}, Tm.const n₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ δ ⊢ ρ
assumption All goals completed! 🐙
| mult₁ hs => mult₁ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t₁'✝ * t₂✝ ⦂ Nat }> ∧ δ' ⊢ ρ'
have ⟨δ', hExt, hTy', hStoreTy'⟩ := ih₁ hs rfl mult₁ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t₁'✝ * t₂✝ ⦂ Nat }> ∧ δ' ⊢ ρ'
exists δ' mult₁ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ Extends δ' δ ∧ <{ ∅ / δ' ⊢ t₁'✝ * t₂✝ ⦂ Nat }> ∧ δ' ⊢ ρ'; constructor mult₁.left δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ Extends δ' δmult₁.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ t₁'✝ * t₂✝ ⦂ Nat }> ∧ δ' ⊢ ρ'
assumption mult₁.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ t₁'✝ * t₂✝ ⦂ Nat }> ∧ δ' ⊢ ρ'; constructor mult₁.right.left δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ t₁'✝ * t₂✝ ⦂ Nat }>mult₁.right.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ δ' ⊢ ρ'
solve_by_elim [store_weakening] using StlcRefTyping mult₁.right.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ δ' ⊢ ρ'
assumption All goals completed! 🐙
| mult₂ _ hs => mult₂ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₂'✝:Tmh₁✝:t₁✝.IsValuehs:t₂✝ / ρ ⟶ t₂'✝ / ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t₁✝ * t₂'✝ ⦂ Nat }> ∧ δ' ⊢ ρ'
have ⟨δ', hExt, hTy', hStoreTy'⟩ := ih₂ hs rfl mult₂ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₂'✝:Tmh₁✝:t₁✝.IsValuehs:t₂✝ / ρ ⟶ t₂'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₂'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t₁✝ * t₂'✝ ⦂ Nat }> ∧ δ' ⊢ ρ'
exists δ' mult₂ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₂'✝:Tmh₁✝:t₁✝.IsValuehs:t₂✝ / ρ ⟶ t₂'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₂'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ Extends δ' δ ∧ <{ ∅ / δ' ⊢ t₁✝ * t₂'✝ ⦂ Nat }> ∧ δ' ⊢ ρ'; constructor mult₂.left δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₂'✝:Tmh₁✝:t₁✝.IsValuehs:t₂✝ / ρ ⟶ t₂'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₂'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ Extends δ' δmult₂.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₂'✝:Tmh₁✝:t₁✝.IsValuehs:t₂✝ / ρ ⟶ t₂'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₂'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ t₁✝ * t₂'✝ ⦂ Nat }> ∧ δ' ⊢ ρ'
assumption mult₂.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₂'✝:Tmh₁✝:t₁✝.IsValuehs:t₂✝ / ρ ⟶ t₂'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₂'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ t₁✝ * t₂'✝ ⦂ Nat }> ∧ δ' ⊢ ρ'; constructor mult₂.right.left δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₂'✝:Tmh₁✝:t₁✝.IsValuehs:t₂✝ / ρ ⟶ t₂'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₂'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ t₁✝ * t₂'✝ ⦂ Nat }>mult₂.right.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₂'✝:Tmh₁✝:t₁✝.IsValuehs:t₂✝ / ρ ⟶ t₂'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₂'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ δ' ⊢ ρ'
solve_by_elim [store_weakening] using StlcRefTyping mult₂.right.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ Nat }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ't₂'✝:Tmh₁✝:t₁✝.IsValuehs:t₂✝ / ρ ⟶ t₂'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₂'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ δ' ⊢ ρ'
assumption All goals completed! 🐙
| ite0 _ h₂ h₃ ih₁ _ _ => ite0 δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmt₃✝:Tmτ✝:Tyt':TmhEval:<{ if0 t₁✝ then t₂✝ else t₃✝ }> / ρ ⟶ t' / ρ'h₁✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ'h₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ'
inversion hEval with
| if0Step hs => if0Step δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmt₃✝:Tmτ✝:Tyh₁✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ'h₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ if0 t₁'✝ then t₂✝ else t₃✝ ⦂ τ✝ }> ∧ δ' ⊢ ρ'
have ⟨δ', hExt, hTy', hStoreTy'⟩ := ih₁ hs rfl if0Step δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmt₃✝:Tmτ✝:Tyh₁✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ'h₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ if0 t₁'✝ then t₂✝ else t₃✝ ⦂ τ✝ }> ∧ δ' ⊢ ρ'
exists δ' if0Step δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmt₃✝:Tmτ✝:Tyh₁✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ'h₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ Extends δ' δ ∧ <{ ∅ / δ' ⊢ if0 t₁'✝ then t₂✝ else t₃✝ ⦂ τ✝ }> ∧ δ' ⊢ ρ'; constructor if0Step.left δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmt₃✝:Tmτ✝:Tyh₁✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ'h₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ Extends δ' δif0Step.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmt₃✝:Tmτ✝:Tyh₁✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ'h₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ if0 t₁'✝ then t₂✝ else t₃✝ ⦂ τ✝ }> ∧ δ' ⊢ ρ'
assumption if0Step.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmt₃✝:Tmτ✝:Tyh₁✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ'h₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ if0 t₁'✝ then t₂✝ else t₃✝ ⦂ τ✝ }> ∧ δ' ⊢ ρ'; constructor if0Step.right.left δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmt₃✝:Tmτ✝:Tyh₁✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ'h₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ if0 t₁'✝ then t₂✝ else t₃✝ ⦂ τ✝ }>if0Step.right.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmt₃✝:Tmτ✝:Tyh₁✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ'h₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ δ' ⊢ ρ'
constructor if0Step.right.left.h₁ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmt₃✝:Tmτ✝:Tyh₁✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ'h₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>if0Step.right.left.h₂ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmt₃✝:Tmτ✝:Tyh₁✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ'h₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ t₂✝ ⦂ τ✝ }>if0Step.right.left.h₃ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmt₃✝:Tmτ✝:Tyh₁✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ'h₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ t₃✝ ⦂ τ✝ }> <;> if0Step.right.left.h₁ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmt₃✝:Tmτ✝:Tyh₁✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ'h₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>if0Step.right.left.h₂ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmt₃✝:Tmτ✝:Tyh₁✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ'h₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ t₂✝ ⦂ τ✝ }>if0Step.right.left.h₃ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmt₃✝:Tmτ✝:Tyh₁✝:<{ ∅ / δ ⊢ t₁✝ ⦂ Nat }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ'h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ'h₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Nat }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ t₃✝ ⦂ τ✝ }> solve_by_elim [store_weakening] using StlcRefTyping All goals completed! 🐙
assumption All goals completed! 🐙
| if0Zero => if0Zero δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tmt₃✝:Tmτ✝:Tyh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>h₁✝:<{ ∅ / δ ⊢ 0 ⦂ Nat }>h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρh₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρih₁:∀ {t' : Tm}, <{ 0 }> / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t₂✝ ⦂ τ✝ }> ∧ δ' ⊢ ρ
exists δ if0Zero δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tmt₃✝:Tmτ✝:Tyh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>h₁✝:<{ ∅ / δ ⊢ 0 ⦂ Nat }>h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρh₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρih₁:∀ {t' : Tm}, <{ 0 }> / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ Extends δ δ ∧ <{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }> ∧ δ ⊢ ρ; constructor if0Zero.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tmt₃✝:Tmτ✝:Tyh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>h₁✝:<{ ∅ / δ ⊢ 0 ⦂ Nat }>h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρh₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρih₁:∀ {t' : Tm}, <{ 0 }> / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ Extends δ δif0Zero.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tmt₃✝:Tmτ✝:Tyh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>h₁✝:<{ ∅ / δ ⊢ 0 ⦂ Nat }>h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρh₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρih₁:∀ {t' : Tm}, <{ 0 }> / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ <{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }> ∧ δ ⊢ ρ
apply extends_refl if0Zero.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tmt₃✝:Tmτ✝:Tyh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>h₁✝:<{ ∅ / δ ⊢ 0 ⦂ Nat }>h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρh₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρih₁:∀ {t' : Tm}, <{ 0 }> / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ <{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }> ∧ δ ⊢ ρ; constructor if0Zero.right.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tmt₃✝:Tmτ✝:Tyh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>h₁✝:<{ ∅ / δ ⊢ 0 ⦂ Nat }>h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρh₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρih₁:∀ {t' : Tm}, <{ 0 }> / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ <{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>if0Zero.right.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tmt₃✝:Tmτ✝:Tyh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>h₁✝:<{ ∅ / δ ⊢ 0 ⦂ Nat }>h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρh₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρih₁:∀ {t' : Tm}, <{ 0 }> / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ δ ⊢ ρ <;> if0Zero.right.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tmt₃✝:Tmτ✝:Tyh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>h₁✝:<{ ∅ / δ ⊢ 0 ⦂ Nat }>h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρh₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρih₁:∀ {t' : Tm}, <{ 0 }> / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ <{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>if0Zero.right.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tmt₃✝:Tmτ✝:Tyh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>h₁✝:<{ ∅ / δ ⊢ 0 ⦂ Nat }>h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρh₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρih₁:∀ {t' : Tm}, <{ 0 }> / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ δ ⊢ ρ assumption All goals completed! 🐙
| if0Nonzero => if0Nonzero δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tmt₃✝:Tmτ✝:Tyh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>n✝:Nath₁✝:<{ ∅ / δ ⊢ ~(Tm.const (n✝ + 1)) ⦂ Nat }>h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρh₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρih₁:∀ {t' : Tm}, Tm.const (n✝ + 1) / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t₃✝ ⦂ τ✝ }> ∧ δ' ⊢ ρ
exists δ if0Nonzero δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tmt₃✝:Tmτ✝:Tyh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>n✝:Nath₁✝:<{ ∅ / δ ⊢ ~(Tm.const (n✝ + 1)) ⦂ Nat }>h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρh₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρih₁:∀ {t' : Tm}, Tm.const (n✝ + 1) / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ Extends δ δ ∧ <{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }> ∧ δ ⊢ ρ; constructor if0Nonzero.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tmt₃✝:Tmτ✝:Tyh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>n✝:Nath₁✝:<{ ∅ / δ ⊢ ~(Tm.const (n✝ + 1)) ⦂ Nat }>h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρh₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρih₁:∀ {t' : Tm}, Tm.const (n✝ + 1) / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ Extends δ δif0Nonzero.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tmt₃✝:Tmτ✝:Tyh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>n✝:Nath₁✝:<{ ∅ / δ ⊢ ~(Tm.const (n✝ + 1)) ⦂ Nat }>h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρh₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρih₁:∀ {t' : Tm}, Tm.const (n✝ + 1) / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ <{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }> ∧ δ ⊢ ρ
apply extends_refl if0Nonzero.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tmt₃✝:Tmτ✝:Tyh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>n✝:Nath₁✝:<{ ∅ / δ ⊢ ~(Tm.const (n✝ + 1)) ⦂ Nat }>h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρh₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρih₁:∀ {t' : Tm}, Tm.const (n✝ + 1) / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ <{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }> ∧ δ ⊢ ρ; constructor if0Nonzero.right.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tmt₃✝:Tmτ✝:Tyh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>n✝:Nath₁✝:<{ ∅ / δ ⊢ ~(Tm.const (n✝ + 1)) ⦂ Nat }>h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρh₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρih₁:∀ {t' : Tm}, Tm.const (n✝ + 1) / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ <{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>if0Nonzero.right.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tmt₃✝:Tmτ✝:Tyh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>n✝:Nath₁✝:<{ ∅ / δ ⊢ ~(Tm.const (n✝ + 1)) ⦂ Nat }>h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρh₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρih₁:∀ {t' : Tm}, Tm.const (n✝ + 1) / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ δ ⊢ ρ <;> if0Nonzero.right.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tmt₃✝:Tmτ✝:Tyh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>n✝:Nath₁✝:<{ ∅ / δ ⊢ ~(Tm.const (n✝ + 1)) ⦂ Nat }>h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρh₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρih₁:∀ {t' : Tm}, Tm.const (n✝ + 1) / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ <{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>if0Nonzero.right.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tmt₃✝:Tmτ✝:Tyh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ✝ }>h₃:<{ ∅ / δ ⊢ t₃✝ ⦂ τ✝ }>n✝:Nath₁✝:<{ ∅ / δ ⊢ ~(Tm.const (n✝ + 1)) ⦂ Nat }>h₂_ih✝:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρh₃_ih✝:∀ {t' : Tm}, t₃✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ✝ }> ∧ δ' ⊢ ρih₁:∀ {t' : Tm}, Tm.const (n✝ + 1) / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Nat }> ∧ δ' ⊢ ρ⊢ δ ⊢ ρ assumption All goals completed! 🐙
| @ref_ _ _ τ₁ h ih => ref_ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁:Tyt':TmhEval:<{ ref t₁✝ }> / ρ ⟶ t' / ρ'h:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₁ }> ∧ δ' ⊢ ρ'
inversion hEval with
| refValue => refValue δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>h✝:t₁✝.IsValueih:∀ {t' : Tm},
t₁✝ / ρ ⟶ t' / List.concat ρ t₁✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ List.concat ρ t₁✝⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ ~(Tm.loc (List.length ρ)) ⦂ Ref τ₁ }> ∧ δ' ⊢ List.concat ρ t₁✝
exists δ.concat τ₁ refValue δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>h✝:t₁✝.IsValueih:∀ {t' : Tm},
t₁✝ / ρ ⟶ t' / List.concat ρ t₁✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ List.concat ρ t₁✝⊢ Extends (List.concat δ τ₁) δ ∧
<{ ∅ / (List.concat δ τ₁) ⊢ ~(Tm.loc (List.length ρ)) ⦂ Ref τ₁ }> ∧ List.concat δ τ₁ ⊢ List.concat ρ t₁✝; constructor refValue.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>h✝:t₁✝.IsValueih:∀ {t' : Tm},
t₁✝ / ρ ⟶ t' / List.concat ρ t₁✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ List.concat ρ t₁✝⊢ Extends (List.concat δ τ₁) δrefValue.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>h✝:t₁✝.IsValueih:∀ {t' : Tm},
t₁✝ / ρ ⟶ t' / List.concat ρ t₁✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ List.concat ρ t₁✝⊢ <{ ∅ / (List.concat δ τ₁) ⊢ ~(Tm.loc (List.length ρ)) ⦂ Ref τ₁ }> ∧ List.concat δ τ₁ ⊢ List.concat ρ t₁✝
· refValue.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>h✝:t₁✝.IsValueih:∀ {t' : Tm},
t₁✝ / ρ ⟶ t' / List.concat ρ t₁✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ List.concat ρ t₁✝⊢ Extends (List.concat δ τ₁) δ rw [List.concat_eq_append refValue.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>h✝:t₁✝.IsValueih:∀ {t' : Tm},
t₁✝ / ρ ⟶ t' / List.concat ρ t₁✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ List.concat ρ t₁✝⊢ Extends (δ ++ [τ₁]) δ] refValue.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>h✝:t₁✝.IsValueih:∀ {t' : Tm},
t₁✝ / ρ ⟶ t' / List.concat ρ t₁✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ List.concat ρ t₁✝⊢ Extends (δ ++ [τ₁]) δ; apply extends_app All goals completed! 🐙
· refValue.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>h✝:t₁✝.IsValueih:∀ {t' : Tm},
t₁✝ / ρ ⟶ t' / List.concat ρ t₁✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ List.concat ρ t₁✝⊢ <{ ∅ / (List.concat δ τ₁) ⊢ ~(Tm.loc (List.length ρ)) ⦂ Ref τ₁ }> ∧ List.concat δ τ₁ ⊢ List.concat ρ t₁✝ constructor refValue.right.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>h✝:t₁✝.IsValueih:∀ {t' : Tm},
t₁✝ / ρ ⟶ t' / List.concat ρ t₁✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ List.concat ρ t₁✝⊢ <{ ∅ / (List.concat δ τ₁) ⊢ ~(Tm.loc (List.length ρ)) ⦂ Ref τ₁ }>refValue.right.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>h✝:t₁✝.IsValueih:∀ {t' : Tm},
t₁✝ / ρ ⟶ t' / List.concat ρ t₁✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ List.concat ρ t₁✝⊢ List.concat δ τ₁ ⊢ List.concat ρ t₁✝
· refValue.right.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>h✝:t₁✝.IsValueih:∀ {t' : Tm},
t₁✝ / ρ ⟶ t' / List.concat ρ t₁✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ List.concat ρ t₁✝⊢ <{ ∅ / (List.concat δ τ₁) ⊢ ~(Tm.loc (List.length ρ)) ⦂ Ref τ₁ }> have h : <{Ref τ₁}> = <{Ref ~((δ.concat τ₁)[ρ.length])}> := by δ:StoreTyt:Tmt':Tmτ:Tyρ:Storeρ':StorehTy:<{ ∅ / δ ⊢ t ⦂ τ }>hStoreTy:δ ⊢ ρhEval:t / ρ ⟶ t' / ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ }> ∧ δ' ⊢ ρ'
simp_all [StoreWellTyped, MyGetElem.getElem] refValue.right.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁:Tyh✝¹:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>h✝:t₁✝.IsValueih:∀ {t' : Tm},
t₁✝ / ρ ⟶ t' / List.concat ρ t₁✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ List.concat ρ t₁✝h:<{ Ref τ₁ }> = <{ Ref ~(List.concat δ τ₁)[List.length ρ] }>⊢ <{ ∅ / (List.concat δ τ₁) ⊢ ~(Tm.loc (List.length ρ)) ⦂ Ref τ₁ }>
rw [h refValue.right.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁:Tyh✝¹:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>h✝:t₁✝.IsValueih:∀ {t' : Tm},
t₁✝ / ρ ⟶ t' / List.concat ρ t₁✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ List.concat ρ t₁✝h:<{ Ref τ₁ }> = <{ Ref ~(List.concat δ τ₁)[List.length ρ] }>⊢ <{ ∅ / (List.concat δ τ₁) ⊢ ~(Tm.loc (List.length ρ)) ⦂ Ref ~(List.concat δ τ₁)[List.length ρ] }>] refValue.right.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁:Tyh✝¹:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>h✝:t₁✝.IsValueih:∀ {t' : Tm},
t₁✝ / ρ ⟶ t' / List.concat ρ t₁✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ List.concat ρ t₁✝h:<{ Ref τ₁ }> = <{ Ref ~(List.concat δ τ₁)[List.length ρ] }>⊢ <{ ∅ / (List.concat δ τ₁) ⊢ ~(Tm.loc (List.length ρ)) ⦂ Ref ~(List.concat δ τ₁)[List.length ρ] }>
constructor refValue.right.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁:Tyh✝¹:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>h✝:t₁✝.IsValueih:∀ {t' : Tm},
t₁✝ / ρ ⟶ t' / List.concat ρ t₁✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ List.concat ρ t₁✝h:<{ Ref τ₁ }> = <{ Ref ~(List.concat δ τ₁)[List.length ρ] }>⊢ List.length ρ < (List.concat δ τ₁).length
simp [StoreWellTyped] at hStoreTy ⊢ refValue.right.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:List.length δ = List.length ρ ∧ ∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>Γ:Contextt₁✝:Tmτ₁:Tyh✝¹:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>h✝:t₁✝.IsValueih:∀ {t' : Tm},
t₁✝ / ρ ⟶ t' / List.concat ρ t₁✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ List.concat ρ t₁✝h:<{ Ref τ₁ }> = <{ Ref ~(List.concat δ τ₁)[List.length ρ] }>⊢ List.length ρ < List.length δ + 1; lia All goals completed! 🐙
· refValue.right.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>h✝:t₁✝.IsValueih:∀ {t' : Tm},
t₁✝ / ρ ⟶ t' / List.concat ρ t₁✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ List.concat ρ t₁✝⊢ List.concat δ τ₁ ⊢ List.concat ρ t₁✝ apply store_well_typed_app refValue.right.right.hStoreTy δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>h✝:t₁✝.IsValueih:∀ {t' : Tm},
t₁✝ / ρ ⟶ t' / List.concat ρ t₁✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ List.concat ρ t₁✝⊢ δ ⊢ ρrefValue.right.right.hTy δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>h✝:t₁✝.IsValueih:∀ {t' : Tm},
t₁✝ / ρ ⟶ t' / List.concat ρ t₁✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ List.concat ρ t₁✝⊢ <{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }> <;> refValue.right.right.hStoreTy δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>h✝:t₁✝.IsValueih:∀ {t' : Tm},
t₁✝ / ρ ⟶ t' / List.concat ρ t₁✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ List.concat ρ t₁✝⊢ δ ⊢ ρrefValue.right.right.hTy δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>h✝:t₁✝.IsValueih:∀ {t' : Tm},
t₁✝ / ρ ⟶ t' / List.concat ρ t₁✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ List.concat ρ t₁✝⊢ <{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }> assumption All goals completed! 🐙
| ref_ hs => ref_ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ ref t₁'✝ ⦂ Ref τ₁ }> ∧ δ' ⊢ ρ'
have ⟨δ', hExt, hTy', hStoreTy'⟩ := ih hs rfl ref_ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ τ₁ }>hStoreTy':δ' ⊢ ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ ref t₁'✝ ⦂ Ref τ₁ }> ∧ δ' ⊢ ρ'
exists δ' ref_ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ τ₁ }>hStoreTy':δ' ⊢ ρ'⊢ Extends δ' δ ∧ <{ ∅ / δ' ⊢ ref t₁'✝ ⦂ Ref τ₁ }> ∧ δ' ⊢ ρ'; constructor ref_.left δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ τ₁ }>hStoreTy':δ' ⊢ ρ'⊢ Extends δ' δref_.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ τ₁ }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ ref t₁'✝ ⦂ Ref τ₁ }> ∧ δ' ⊢ ρ'
assumption ref_.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ τ₁ }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ ref t₁'✝ ⦂ Ref τ₁ }> ∧ δ' ⊢ ρ'; constructor ref_.right.left δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ τ₁ }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ ref t₁'✝ ⦂ Ref τ₁ }>ref_.right.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ τ₁ }>hStoreTy':δ' ⊢ ρ'⊢ δ' ⊢ ρ'
solve_by_elim [store_weakening] using StlcRefTyping ref_.right.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ τ₁ }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ τ₁ }>hStoreTy':δ' ⊢ ρ'⊢ δ' ⊢ ρ'
assumption All goals completed! 🐙
| deref h ih => deref δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁✝:Tyt':TmhEval:<{ !t₁✝ }> / ρ ⟶ t' / ρ'h:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₁✝ }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₁✝ }> ∧ δ' ⊢ ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₁✝ }> ∧ δ' ⊢ ρ'
inversion hEval with
| derefLoc hl => derefLoc δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextτ₁✝:Tyl✝:Nath:<{ ∅ / δ ⊢ ~(Tm.loc l✝) ⦂ Ref τ₁✝ }>hl:l✝ < List.length ρih:∀ {t' : Tm}, Tm.loc l✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₁✝ }> ∧ δ' ⊢ ρ⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ ~ρ[l✝] ⦂ τ₁✝ }> ∧ δ' ⊢ ρ
inversion h loc_ δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextl✝:Nathl:l✝ < List.length ρh✝:l✝ < List.length δih:∀ {t' : Tm}, Tm.loc l✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref ~δ[l✝] }> ∧ δ' ⊢ ρ⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ ~ρ[l✝] ⦂ ~δ[l✝] }> ∧ δ' ⊢ ρ
exists δ loc_ δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextl✝:Nathl:l✝ < List.length ρh✝:l✝ < List.length δih:∀ {t' : Tm}, Tm.loc l✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref ~δ[l✝] }> ∧ δ' ⊢ ρ⊢ Extends δ δ ∧ <{ ∅ / δ ⊢ ~ρ[l✝] ⦂ ~δ[l✝] }> ∧ δ ⊢ ρ; constructor loc_.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextl✝:Nathl:l✝ < List.length ρh✝:l✝ < List.length δih:∀ {t' : Tm}, Tm.loc l✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref ~δ[l✝] }> ∧ δ' ⊢ ρ⊢ Extends δ δloc_.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextl✝:Nathl:l✝ < List.length ρh✝:l✝ < List.length δih:∀ {t' : Tm}, Tm.loc l✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref ~δ[l✝] }> ∧ δ' ⊢ ρ⊢ <{ ∅ / δ ⊢ ~ρ[l✝] ⦂ ~δ[l✝] }> ∧ δ ⊢ ρ
apply extends_refl loc_.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextl✝:Nathl:l✝ < List.length ρh✝:l✝ < List.length δih:∀ {t' : Tm}, Tm.loc l✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref ~δ[l✝] }> ∧ δ' ⊢ ρ⊢ <{ ∅ / δ ⊢ ~ρ[l✝] ⦂ ~δ[l✝] }> ∧ δ ⊢ ρ; constructor loc_.right.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextl✝:Nathl:l✝ < List.length ρh✝:l✝ < List.length δih:∀ {t' : Tm}, Tm.loc l✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref ~δ[l✝] }> ∧ δ' ⊢ ρ⊢ <{ ∅ / δ ⊢ ~ρ[l✝] ⦂ ~δ[l✝] }>loc_.right.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextl✝:Nathl:l✝ < List.length ρh✝:l✝ < List.length δih:∀ {t' : Tm}, Tm.loc l✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref ~δ[l✝] }> ∧ δ' ⊢ ρ⊢ δ ⊢ ρ
-- `h₂` is exactly the fact that `ρ[l]` has the type
-- `δ` claims for it
have ⟨h₁, h₂⟩ := hStoreTy loc_.right.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextl✝:Nathl:l✝ < List.length ρh✝:l✝ < List.length δih:∀ {t' : Tm}, Tm.loc l✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref ~δ[l✝] }> ∧ δ' ⊢ ρh₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>⊢ <{ ∅ / δ ⊢ ~ρ[l✝] ⦂ ~δ[l✝] }>loc_.right.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextl✝:Nathl:l✝ < List.length ρh✝:l✝ < List.length δih:∀ {t' : Tm}, Tm.loc l✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref ~δ[l✝] }> ∧ δ' ⊢ ρ⊢ δ ⊢ ρ
apply h₂ loc_.right.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextl✝:Nathl:l✝ < List.length ρh✝:l✝ < List.length δih:∀ {t' : Tm}, Tm.loc l✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref ~δ[l✝] }> ∧ δ' ⊢ ρh₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>⊢ l✝ < List.length ρ <;> loc_.right.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextl✝:Nathl:l✝ < List.length ρh✝:l✝ < List.length δih:∀ {t' : Tm}, Tm.loc l✝ / ρ ⟶ t' / ρ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref ~δ[l✝] }> ∧ δ' ⊢ ρh₁:List.length δ = List.length ρh₂:∀ (l : Nat), l < List.length ρ → <{ ∅ / δ ⊢ ~ρ[l] ⦂ ~δ[l] }>⊢ l✝ < List.length ρ assumption All goals completed! 🐙
assumption All goals completed! 🐙
| deref hs => deref δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁✝:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₁✝ }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₁✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ !t₁'✝ ⦂ τ₁✝ }> ∧ δ' ⊢ ρ'
have ⟨δ', hExt, hTy', hStoreTy'⟩ := ih hs rfl deref δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁✝:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₁✝ }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₁✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Ref τ₁✝ }>hStoreTy':δ' ⊢ ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ !t₁'✝ ⦂ τ₁✝ }> ∧ δ' ⊢ ρ'
exists δ' deref δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁✝:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₁✝ }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₁✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Ref τ₁✝ }>hStoreTy':δ' ⊢ ρ'⊢ Extends δ' δ ∧ <{ ∅ / δ' ⊢ !t₁'✝ ⦂ τ₁✝ }> ∧ δ' ⊢ ρ'; constructor deref.left δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁✝:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₁✝ }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₁✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Ref τ₁✝ }>hStoreTy':δ' ⊢ ρ'⊢ Extends δ' δderef.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁✝:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₁✝ }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₁✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Ref τ₁✝ }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ !t₁'✝ ⦂ τ₁✝ }> ∧ δ' ⊢ ρ'
assumption deref.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁✝:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₁✝ }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₁✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Ref τ₁✝ }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ !t₁'✝ ⦂ τ₁✝ }> ∧ δ' ⊢ ρ'; constructor deref.right.left δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁✝:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₁✝ }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₁✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Ref τ₁✝ }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ !t₁'✝ ⦂ τ₁✝ }>deref.right.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁✝:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₁✝ }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₁✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Ref τ₁✝ }>hStoreTy':δ' ⊢ ρ'⊢ δ' ⊢ ρ'
solve_by_elim [store_weakening] using StlcRefTyping deref.right.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmτ₁✝:Tyh:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₁✝ }>ih:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₁✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Ref τ₁✝ }>hStoreTy':δ' ⊢ ρ'⊢ δ' ⊢ ρ'
assumption All goals completed! 🐙
| assign h₁ h₂ ih₁ ih₂ => assign δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmτ₂✝:Tyt':TmhEval:<{ t₁✝ := t₂✝ }> / ρ ⟶ t' / ρ'h₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₂✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Unit }> ∧ δ' ⊢ ρ'
inversion hEval with
| assign _ hl => assign δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tmτ₂✝:Tyh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>l✝:Nath₁:<{ ∅ / δ ⊢ ~(Tm.loc l✝) ⦂ Ref τ₂✝ }>h₁✝:t₂✝.IsValuehl:l✝ < List.length ρih₂:∀ {t' : Tm},
t₂✝ / ρ ⟶ t' / List.set ρ l✝ t₂✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ List.set ρ l✝ t₂✝ih₁:∀ {t' : Tm},
Tm.loc l✝ / ρ ⟶ t' / List.set ρ l✝ t₂✝ →
∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₂✝ }> ∧ δ' ⊢ List.set ρ l✝ t₂✝⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ unit ⦂ Unit }> ∧ δ' ⊢ List.set ρ l✝ t₂✝
inversion h₁ loc_ δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tml✝:Nath₁✝:t₂✝.IsValuehl:l✝ < List.length ρh✝:l✝ < List.length δh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ ~δ[l✝] }>ih₂:∀ {t' : Tm},
t₂✝ / ρ ⟶ t' / List.set ρ l✝ t₂✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ ~δ[l✝] }> ∧ δ' ⊢ List.set ρ l✝ t₂✝ih₁:∀ {t' : Tm},
Tm.loc l✝ / ρ ⟶ t' / List.set ρ l✝ t₂✝ →
∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref ~δ[l✝] }> ∧ δ' ⊢ List.set ρ l✝ t₂✝⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ unit ⦂ Unit }> ∧ δ' ⊢ List.set ρ l✝ t₂✝
exists δ loc_ δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tml✝:Nath₁✝:t₂✝.IsValuehl:l✝ < List.length ρh✝:l✝ < List.length δh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ ~δ[l✝] }>ih₂:∀ {t' : Tm},
t₂✝ / ρ ⟶ t' / List.set ρ l✝ t₂✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ ~δ[l✝] }> ∧ δ' ⊢ List.set ρ l✝ t₂✝ih₁:∀ {t' : Tm},
Tm.loc l✝ / ρ ⟶ t' / List.set ρ l✝ t₂✝ →
∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref ~δ[l✝] }> ∧ δ' ⊢ List.set ρ l✝ t₂✝⊢ Extends δ δ ∧ <{ ∅ / δ ⊢ unit ⦂ Unit }> ∧ δ ⊢ List.set ρ l✝ t₂✝; constructor loc_.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tml✝:Nath₁✝:t₂✝.IsValuehl:l✝ < List.length ρh✝:l✝ < List.length δh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ ~δ[l✝] }>ih₂:∀ {t' : Tm},
t₂✝ / ρ ⟶ t' / List.set ρ l✝ t₂✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ ~δ[l✝] }> ∧ δ' ⊢ List.set ρ l✝ t₂✝ih₁:∀ {t' : Tm},
Tm.loc l✝ / ρ ⟶ t' / List.set ρ l✝ t₂✝ →
∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref ~δ[l✝] }> ∧ δ' ⊢ List.set ρ l✝ t₂✝⊢ Extends δ δloc_.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tml✝:Nath₁✝:t₂✝.IsValuehl:l✝ < List.length ρh✝:l✝ < List.length δh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ ~δ[l✝] }>ih₂:∀ {t' : Tm},
t₂✝ / ρ ⟶ t' / List.set ρ l✝ t₂✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ ~δ[l✝] }> ∧ δ' ⊢ List.set ρ l✝ t₂✝ih₁:∀ {t' : Tm},
Tm.loc l✝ / ρ ⟶ t' / List.set ρ l✝ t₂✝ →
∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref ~δ[l✝] }> ∧ δ' ⊢ List.set ρ l✝ t₂✝⊢ <{ ∅ / δ ⊢ unit ⦂ Unit }> ∧ δ ⊢ List.set ρ l✝ t₂✝
apply extends_refl loc_.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tml✝:Nath₁✝:t₂✝.IsValuehl:l✝ < List.length ρh✝:l✝ < List.length δh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ ~δ[l✝] }>ih₂:∀ {t' : Tm},
t₂✝ / ρ ⟶ t' / List.set ρ l✝ t₂✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ ~δ[l✝] }> ∧ δ' ⊢ List.set ρ l✝ t₂✝ih₁:∀ {t' : Tm},
Tm.loc l✝ / ρ ⟶ t' / List.set ρ l✝ t₂✝ →
∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref ~δ[l✝] }> ∧ δ' ⊢ List.set ρ l✝ t₂✝⊢ <{ ∅ / δ ⊢ unit ⦂ Unit }> ∧ δ ⊢ List.set ρ l✝ t₂✝; constructor loc_.right.left δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tml✝:Nath₁✝:t₂✝.IsValuehl:l✝ < List.length ρh✝:l✝ < List.length δh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ ~δ[l✝] }>ih₂:∀ {t' : Tm},
t₂✝ / ρ ⟶ t' / List.set ρ l✝ t₂✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ ~δ[l✝] }> ∧ δ' ⊢ List.set ρ l✝ t₂✝ih₁:∀ {t' : Tm},
Tm.loc l✝ / ρ ⟶ t' / List.set ρ l✝ t₂✝ →
∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref ~δ[l✝] }> ∧ δ' ⊢ List.set ρ l✝ t₂✝⊢ <{ ∅ / δ ⊢ unit ⦂ Unit }>loc_.right.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tml✝:Nath₁✝:t₂✝.IsValuehl:l✝ < List.length ρh✝:l✝ < List.length δh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ ~δ[l✝] }>ih₂:∀ {t' : Tm},
t₂✝ / ρ ⟶ t' / List.set ρ l✝ t₂✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ ~δ[l✝] }> ∧ δ' ⊢ List.set ρ l✝ t₂✝ih₁:∀ {t' : Tm},
Tm.loc l✝ / ρ ⟶ t' / List.set ρ l✝ t₂✝ →
∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref ~δ[l✝] }> ∧ δ' ⊢ List.set ρ l✝ t₂✝⊢ δ ⊢ List.set ρ l✝ t₂✝
constructor loc_.right.right δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tml✝:Nath₁✝:t₂✝.IsValuehl:l✝ < List.length ρh✝:l✝ < List.length δh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ ~δ[l✝] }>ih₂:∀ {t' : Tm},
t₂✝ / ρ ⟶ t' / List.set ρ l✝ t₂✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ ~δ[l✝] }> ∧ δ' ⊢ List.set ρ l✝ t₂✝ih₁:∀ {t' : Tm},
Tm.loc l✝ / ρ ⟶ t' / List.set ρ l✝ t₂✝ →
∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref ~δ[l✝] }> ∧ δ' ⊢ List.set ρ l✝ t₂✝⊢ δ ⊢ List.set ρ l✝ t₂✝
-- `assign_pres_store_typing` needs the new value's type
-- to match `δ[l]`
apply assign_pres_store_typing loc_.right.right.hLen δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tml✝:Nath₁✝:t₂✝.IsValuehl:l✝ < List.length ρh✝:l✝ < List.length δh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ ~δ[l✝] }>ih₂:∀ {t' : Tm},
t₂✝ / ρ ⟶ t' / List.set ρ l✝ t₂✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ ~δ[l✝] }> ∧ δ' ⊢ List.set ρ l✝ t₂✝ih₁:∀ {t' : Tm},
Tm.loc l✝ / ρ ⟶ t' / List.set ρ l✝ t₂✝ →
∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref ~δ[l✝] }> ∧ δ' ⊢ List.set ρ l✝ t₂✝⊢ l✝ < List.length ρloc_.right.right.hStoreTy δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tml✝:Nath₁✝:t₂✝.IsValuehl:l✝ < List.length ρh✝:l✝ < List.length δh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ ~δ[l✝] }>ih₂:∀ {t' : Tm},
t₂✝ / ρ ⟶ t' / List.set ρ l✝ t₂✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ ~δ[l✝] }> ∧ δ' ⊢ List.set ρ l✝ t₂✝ih₁:∀ {t' : Tm},
Tm.loc l✝ / ρ ⟶ t' / List.set ρ l✝ t₂✝ →
∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref ~δ[l✝] }> ∧ δ' ⊢ List.set ρ l✝ t₂✝⊢ δ ⊢ ρloc_.right.right.hTy δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tml✝:Nath₁✝:t₂✝.IsValuehl:l✝ < List.length ρh✝:l✝ < List.length δh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ ~δ[l✝] }>ih₂:∀ {t' : Tm},
t₂✝ / ρ ⟶ t' / List.set ρ l✝ t₂✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ ~δ[l✝] }> ∧ δ' ⊢ List.set ρ l✝ t₂✝ih₁:∀ {t' : Tm},
Tm.loc l✝ / ρ ⟶ t' / List.set ρ l✝ t₂✝ →
∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref ~δ[l✝] }> ∧ δ' ⊢ List.set ρ l✝ t₂✝⊢ <{ ∅ / δ ⊢ t₂✝ ⦂ ~δ[l✝] }> <;> loc_.right.right.hLen δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tml✝:Nath₁✝:t₂✝.IsValuehl:l✝ < List.length ρh✝:l✝ < List.length δh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ ~δ[l✝] }>ih₂:∀ {t' : Tm},
t₂✝ / ρ ⟶ t' / List.set ρ l✝ t₂✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ ~δ[l✝] }> ∧ δ' ⊢ List.set ρ l✝ t₂✝ih₁:∀ {t' : Tm},
Tm.loc l✝ / ρ ⟶ t' / List.set ρ l✝ t₂✝ →
∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref ~δ[l✝] }> ∧ δ' ⊢ List.set ρ l✝ t₂✝⊢ l✝ < List.length ρloc_.right.right.hStoreTy δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tml✝:Nath₁✝:t₂✝.IsValuehl:l✝ < List.length ρh✝:l✝ < List.length δh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ ~δ[l✝] }>ih₂:∀ {t' : Tm},
t₂✝ / ρ ⟶ t' / List.set ρ l✝ t₂✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ ~δ[l✝] }> ∧ δ' ⊢ List.set ρ l✝ t₂✝ih₁:∀ {t' : Tm},
Tm.loc l✝ / ρ ⟶ t' / List.set ρ l✝ t₂✝ →
∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref ~δ[l✝] }> ∧ δ' ⊢ List.set ρ l✝ t₂✝⊢ δ ⊢ ρloc_.right.right.hTy δ:StoreTyt:Tmτ:Tyρ:StorehStoreTy:δ ⊢ ρΓ:Contextt₂✝:Tml✝:Nath₁✝:t₂✝.IsValuehl:l✝ < List.length ρh✝:l✝ < List.length δh₂:<{ ∅ / δ ⊢ t₂✝ ⦂ ~δ[l✝] }>ih₂:∀ {t' : Tm},
t₂✝ / ρ ⟶ t' / List.set ρ l✝ t₂✝ → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ ~δ[l✝] }> ∧ δ' ⊢ List.set ρ l✝ t₂✝ih₁:∀ {t' : Tm},
Tm.loc l✝ / ρ ⟶ t' / List.set ρ l✝ t₂✝ →
∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref ~δ[l✝] }> ∧ δ' ⊢ List.set ρ l✝ t₂✝⊢ <{ ∅ / δ ⊢ t₂✝ ⦂ ~δ[l✝] }> assumption All goals completed! 🐙
| assign₁ hs => assign₁ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₂✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t₁'✝ := t₂✝ ⦂ Unit }> ∧ δ' ⊢ ρ'
have ⟨δ', hExt, hTy', hStoreTy'⟩ := ih₁ hs rfl assign₁ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₂✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Ref τ₂✝ }>hStoreTy':δ' ⊢ ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t₁'✝ := t₂✝ ⦂ Unit }> ∧ δ' ⊢ ρ'
exists δ' assign₁ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₂✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Ref τ₂✝ }>hStoreTy':δ' ⊢ ρ'⊢ Extends δ' δ ∧ <{ ∅ / δ' ⊢ t₁'✝ := t₂✝ ⦂ Unit }> ∧ δ' ⊢ ρ'; constructor assign₁.left δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₂✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Ref τ₂✝ }>hStoreTy':δ' ⊢ ρ'⊢ Extends δ' δassign₁.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₂✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Ref τ₂✝ }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ t₁'✝ := t₂✝ ⦂ Unit }> ∧ δ' ⊢ ρ'
assumption assign₁.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₂✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Ref τ₂✝ }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ t₁'✝ := t₂✝ ⦂ Unit }> ∧ δ' ⊢ ρ'; constructor assign₁.right.left δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₂✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Ref τ₂✝ }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ t₁'✝ := t₂✝ ⦂ Unit }>assign₁.right.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₂✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Ref τ₂✝ }>hStoreTy':δ' ⊢ ρ'⊢ δ' ⊢ ρ'
solve_by_elim [store_weakening] using StlcRefTyping assign₁.right.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₂✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₁'✝:Tmhs:t₁✝ / ρ ⟶ t₁'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₁'✝ ⦂ Ref τ₂✝ }>hStoreTy':δ' ⊢ ρ'⊢ δ' ⊢ ρ'
assumption All goals completed! 🐙
| assign₂ _ hs => assign₂ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₂✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₂'✝:Tmh₁✝:t₁✝.IsValuehs:t₂✝ / ρ ⟶ t₂'✝ / ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t₁✝ := t₂'✝ ⦂ Unit }> ∧ δ' ⊢ ρ'
have ⟨δ', hExt, hTy', hStoreTy'⟩ := ih₂ hs rfl assign₂ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₂✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₂'✝:Tmh₁✝:t₁✝.IsValuehs:t₂✝ / ρ ⟶ t₂'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₂'✝ ⦂ τ₂✝ }>hStoreTy':δ' ⊢ ρ'⊢ ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t₁✝ := t₂'✝ ⦂ Unit }> ∧ δ' ⊢ ρ'
exists δ' assign₂ δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₂✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₂'✝:Tmh₁✝:t₁✝.IsValuehs:t₂✝ / ρ ⟶ t₂'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₂'✝ ⦂ τ₂✝ }>hStoreTy':δ' ⊢ ρ'⊢ Extends δ' δ ∧ <{ ∅ / δ' ⊢ t₁✝ := t₂'✝ ⦂ Unit }> ∧ δ' ⊢ ρ'; constructor assign₂.left δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₂✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₂'✝:Tmh₁✝:t₁✝.IsValuehs:t₂✝ / ρ ⟶ t₂'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₂'✝ ⦂ τ₂✝ }>hStoreTy':δ' ⊢ ρ'⊢ Extends δ' δassign₂.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₂✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₂'✝:Tmh₁✝:t₁✝.IsValuehs:t₂✝ / ρ ⟶ t₂'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₂'✝ ⦂ τ₂✝ }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ t₁✝ := t₂'✝ ⦂ Unit }> ∧ δ' ⊢ ρ'
assumption assign₂.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₂✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₂'✝:Tmh₁✝:t₁✝.IsValuehs:t₂✝ / ρ ⟶ t₂'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₂'✝ ⦂ τ₂✝ }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ t₁✝ := t₂'✝ ⦂ Unit }> ∧ δ' ⊢ ρ'; constructor assign₂.right.left δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₂✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₂'✝:Tmh₁✝:t₁✝.IsValuehs:t₂✝ / ρ ⟶ t₂'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₂'✝ ⦂ τ₂✝ }>hStoreTy':δ' ⊢ ρ'⊢ <{ ∅ / δ' ⊢ t₁✝ := t₂'✝ ⦂ Unit }>assign₂.right.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₂✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₂'✝:Tmh₁✝:t₁✝.IsValuehs:t₂✝ / ρ ⟶ t₂'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₂'✝ ⦂ τ₂✝ }>hStoreTy':δ' ⊢ ρ'⊢ δ' ⊢ ρ'
solve_by_elim [store_weakening] using StlcRefTyping assign₂.right.right δ:StoreTyt:Tmτ:Tyρ:Storeρ':StorehStoreTy:δ ⊢ ρΓ:Contextt₁✝:Tmt₂✝:Tmτ₂✝:Tyh₁:<{ ∅ / δ ⊢ t₁✝ ⦂ Ref τ₂✝ }>h₂:<{ ∅ / δ ⊢ t₂✝ ⦂ τ₂✝ }>ih₁:∀ {t' : Tm}, t₁✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ Ref τ₂✝ }> ∧ δ' ⊢ ρ'ih₂:∀ {t' : Tm}, t₂✝ / ρ ⟶ t' / ρ' → ∅ = ∅ → ∃ δ', Extends δ' δ ∧ <{ ∅ / δ' ⊢ t' ⦂ τ₂✝ }> ∧ δ' ⊢ ρ't₂'✝:Tmh₁✝:t₁✝.IsValuehs:t₂✝ / ρ ⟶ t₂'✝ / ρ'δ':StoreTyhExt:Extends δ' δhTy':<{ ∅ / δ' ⊢ t₂'✝ ⦂ τ₂✝ }>hStoreTy':δ' ⊢ ρ'⊢ δ' ⊢ ρ'
assumption All goals completed! 🐙
9.6. References and Nontermination
An important fact about the STLC is that it is normalizing — that is, every well-typed term can be reduced to a value in a finite number of steps.
What about STLC + references? Surprisingly, adding references causes us to lose the normalization property: there exist well-typed terms in the STLC + references which can continue to reduce forever, without ever reaching a normal form!
How can we construct such a term? The main idea is to make a function which calls itself. We first make a function which calls another function stored in a reference cell; the trick is that we then smuggle in a reference to itself!
(λR : Ref (Unit → Unit).
R := (λX:Unit. (!R) unit); (!R) unit)
(ref (λX:Unit. unit))
namespace RefsAndNontermination
def loop_fun := <{ λX : Unit. (!R) unit }>
def loop :=
<{ (λR : Ref (Unit → Unit). (( R := (λX : Unit. (!R) unit) ); ( (! R) unit ) ))
(ref (λX : Unit. unit)) }>
This term is well typed:
theorem loop_typeable : ∃ τ, <{ ∅ / [] ⊢ loop ⦂ τ }> := by ⊢ ∃ τ, <{ ∅ / [] ⊢ loop ⦂ τ }>
apply Exists.intro h ⊢ <{ ∅ / [] ⊢ loop ⦂ ~?w }>w ⊢ Ty
apply_rules using StlcRefTyping All goals completed! 🐙
To show formally that the term diverges, we first define the
step_closure of the single-step reduction relation, written
⟶+. This is just like the reflexive step closure of
single-step reduction (which we're been writing ⟶*), except
that it is not reflexive: t ⟶+ t' means that τ can reach
t' by one or more steps of reduction.
inductive StepClosure {X:Type} (R: Relation X) : X → X → Prop :=
| one {x y : X} (h₁ : R x y) : StepClosure R x y
| step {x y z : X} (h₁ : R x y) (h₂ : StepClosure R y z) : StepClosure R x z
scoped notation:40
t:71 " / " ρ:41 " ⟶+ " t':71 " / " ρ':41 =>
StepClosure Step (t, ρ) (t', ρ')
Now, we can show that the expression loop reduces to the
expression !(loc 0) unit and the size-one store
[R:=(loc 0)] loop_fun.
As a convenience, we introduce a slight variant of the normalize
tactic, called reduce, which tries solving the goal with
Multi.refl at each step, instead of waiting until the goal can't
be reduced any more. Of course, the whole point is that loop
doesn't normalize, so the old normalize tactic would just go
into an infinite loop reducing it forever!
syntax "reduce" " using " ident,+ : tactic
macro_rules
| `(tactic| reduce using $xs,*) =>
`(tactic|
repeat
(apply Multi.step
· solve_by_elim (maxDepth := 15) (constructor := false) [Nat.le.refl, Nat.le.step] using $xs,*
try apply Multi.refl))
Next, we use reduce to show that loop steps to
!(loc 0) unit, starting from the ∅ store.
theorem loop_steps_to_loop_fun :
loop / [] ⟶* <{ (! (loc 0)) unit }> / [<{ [R := loc 0] loop_fun }>] := by ⊢ loop / [] ⟶* <{ (!(loc 0)) unit }> / [<{ [R := loc 0] loop_fun }>]
reduce using StlcRefEval All goals completed! 🐙
Finally, we show that the latter expression reduces in two steps to itself!
theorem loop_fun_step_self :
<{ (! (loc 0)) unit }> / [<{ [R := loc 0] loop_fun }>] ⟶+
<{ (! (loc 0)) unit }> / [<{ [R := loc 0] loop_fun }>] := by ⊢ <{ (!(loc 0)) unit }> / [<{ [R := loc 0] loop_fun }>] ⟶+ <{ (!(loc 0)) unit }> / [<{ [R := loc 0] loop_fun }>]
apply StepClosure.step h₁ ⊢ Step (<{ (!(loc 0)) unit }>, [<{ [R := loc 0] loop_fun }>]) ?yh₂ ⊢ StepClosure Step ?y (<{ (!(loc 0)) unit }>, [<{ [R := loc 0] loop_fun }>])y ⊢ Tm × Store; solve_by_elim using StlcRefEval h₂ ⊢ <{ ~[<{ [R := loc 0] loop_fun }>][0] unit }> / [<{ [R := loc 0] loop_fun }>] ⟶+ <{ (!(loc 0)) unit }> /
[<{ [R := loc 0] loop_fun }>]
apply StepClosure.one h₂ ⊢ <{ ~[<{ [R := loc 0] loop_fun }>][0] unit }> / [<{ [R := loc 0] loop_fun }>] ⟶ <{ (!(loc 0)) unit }> /
[<{ [R := loc 0] loop_fun }>]; solve_by_elim using StlcRefEval All goals completed! 🐙
end RefsAndNontermination
9.7. Additional Exercises
end STLCRef