Skip to content

Commit 4126074

Browse files
finished proving fundamental
1 parent 411c4d2 commit 4126074

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

LeanStlc/StrongNorm4.lean

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ theorem SnRed.preservation : Γ ⊢ t : A -> SnRed S Γ t t' -> Γ ⊢ t' : A
6767
| Typing.case h1 h2 h3, .step_case h4 => Typing.case (SnRed.preservation h1 h4) h2 h3
6868
| Typing.fst j1, .step_fst h => Typing.fst (SnRed.preservation j1 h)
6969
| Typing.snd j1, .step_snd h => Typing.snd (SnRed.preservation j1 h)
70-
| _, _ => sorry
7170

7271
mutual
7372
theorem SnNor.rename (m : Γ -⟨r⟩> Δ) : SnNor S Γ t -> SnNor S Δ t[r]
@@ -79,7 +78,7 @@ mutual
7978
| .succ t => .succ (t.rename m)
8079
| .neu t => .neu (t.rename m)
8180
| .red h t' => .red (h.rename m) (t'.rename m)
82-
| .inl h t => .inl (by intro r Δ' h'; sorry) (t.rename m)
81+
| .inl h t => .inl (by intro r Δ' h'; replace h := h (TypingRen.comp m h'); simp at *; sorry) (t.rename m)
8382
| .inr h t => .inr sorry (t.rename m)
8483
| .pair h h1 h2 => .pair sorry (h1.rename m) (h2.rename m)
8584
| .tt => .tt
@@ -218,16 +217,16 @@ theorem ℰ.fst :
218217
SnNor (𝒱 A) Γ t.fst
219218
| eq, Typing.pair j1 j2, SnNor.pair h h1 h2 => SnNor.red (SnRed.fst h2) (by subst eq;simp only [ℛ] at h; replace h := @h id Γ TypingRen.id; simp at h; apply h.1.2)
220219
| eq, j1, SnNor.neu j2 => SnNor.neu (SnNeu.fst j2)
221-
| eq, j1, SnNor.red h j2 => SnNor.red (SnRed.step_fst h) (ℰ.fst rfl (SnRed.preservation j1 h) (by rw [eq] at j2; apply j2))
220+
| eq, j1, SnNor.red h j2 => SnNor.red (SnRed.step_fst h) (ℰ.fst eq (SnRed.preservation j1 h) j2)
222221

223222
theorem ℰ.snd :
224223
S = 𝒱 (.product A B) ->
225224
Γ ⊢ t : (.product A B) ->
226225
SnNor S Γ t ->
227226
SnNor (𝒱 B) Γ t.snd
228-
| eq, Typing.pair j1 j2, SnNor.pair h h1 h2 => SnNor.red (SnRed.snd h2) (by subst eq;simp only [ℛ] at h; replace h := @h id Γ TypingRen.id; simp at h; apply h.2.2)
227+
| eq, Typing.pair j1 j2, SnNor.pair h h1 h2 => SnNor.red (SnRed.snd h1) (by subst eq;simp only [ℛ] at h; replace h := @h id Γ TypingRen.id; simp at h; apply h.2.2)
229228
| eq, j1, SnNor.neu j2 => SnNor.neu (SnNeu.snd j2)
230-
| eq, j1, SnNor.red h j2 => SnNor.red (SnRed.step_fst h) (ℰ.fst rfl (SnRed.preservation j1 h) (by rw [eq] at j2; apply j2))
229+
| eq, j1, SnNor.red h j2 => SnNor.red (SnRed.step_snd h) (ℰ.snd eq (SnRed.preservation j1 h) j2)
231230

232231
theorem fundamental : Γ ⊢ t : A -> Γ ⊨ t : A
233232
| .var xj, σ, Δ, h => h.act xj
@@ -270,11 +269,19 @@ theorem fundamental : Γ ⊢ t : A -> Γ ⊨ t : A
270269
⟨Typing.fst nj'.1, (ℰ.fst rfl nj'.1 nj'.2)⟩
271270
| .snd nj, σ, Δ, h =>
272271
let nj' := fundamental nj h
273-
⟨Typing.snd nj'.1, sorry
274-
| .pair h1 h2, σ, Δ, h =>
272+
⟨Typing.snd nj'.1, (ℰ.snd rfl nj'.1 nj'.2)
273+
| .pair (a := a) (b := b) (A := A) (B := B) h1 h2, σ, Δ, h =>
275274
let h1' := fundamental h1 h
276275
let h2' := fundamental h2 h
277-
⟨Typing.pair h1'.1 h2'.1, SnNor.pair sorry h1'.2 h2'.2
276+
let h1'' : Γ ⊨ a : A := fundamental h1
277+
let h2'' : Γ ⊨ b : B := fundamental h2
278+
have lem1 {Δ' r}: Δ -⟨r⟩> Δ' -> Δ' ⊢ a[σ][r.to] : A ∧ SnNor (𝒱 A) Δ' a[σ][r.to] := λ R =>
279+
⟨(h1'' (SemSubst.compose h R)).1 |> cast (by simp), (h1'' (SemSubst.compose h R)).2 |> cast (by simp)⟩
280+
have lem2 {Δ' r}: Δ -⟨r⟩> Δ' -> Δ' ⊢ b[σ][r.to] : B ∧ SnNor (𝒱 B) Δ' b[σ][r.to] := λ R =>
281+
⟨(h2'' (SemSubst.compose h R)).1 |> cast (by simp), (h2'' (SemSubst.compose h R)).2 |> cast (by simp)⟩
282+
⟨Typing.pair h1'.1 h2'.1, SnNor.pair (λ R =>
283+
⟨⟨(lem1 R).1, (lem1 R).2⟩,
284+
⟨(lem2 R).1, (lem2 R).2⟩⟩) h1'.2 h2'.2
278285
| .tt, σ, Δ, h => ⟨Typing.tt, SnNor.tt⟩
279286

280287
end StrongNormalization4

0 commit comments

Comments
 (0)