Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

seqの場合の証明を完了する #3

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 29 additions & 13 deletions ConcreteSemantics/EquivalenceWithBigStep.lean
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,30 @@ import ConcreteSemantics.SmallStep

open Relation

/-- BigStep と SmallStep の等価性を示す際に使う補題 -/
theorem smallStepStar_skip_seq
{S s t T}
(hS : (S, s) ⇒* (skip, t))
: (S ;; T, s) ⇒* (skip;; T, t) := by
-- hS を `S = skip` のケースと `(S, s) ⇒ (S', s') ∧ (S', s') ⇒* (skip, t)` のケースに分けて考える

-- induction時のエラーを避けるため、一時的に(S₁, s₁)を変数csに一般化する
generalize hcs : (S, s) = cs at hS

-- tail ではなく head の方を使う
induction hS using ReflTransGen.head_induction_on generalizing S s
case refl => simp_all; rfl
case head _ «S', s'» hS₂ _ ih =>
-- 一時的に置いた変数を消す
simp [← hcs] at *; clear hcs

-- Config を Stmt と State にバラす
rcases «S', s'» with ⟨S', s'⟩

calc
_ ⇒ (S';; T, s') := by small_step
_ ⇒* (skip;; T, t) := by apply ih; rfl

/-- BigStep 意味論の式を、SmallStep star に翻訳することができる。 -/
theorem big_step_to_small_step_star {S : Stmt} {s t : State} (h : (S, s) ==> t) : (S, s) ⇒* (skip, t) := by
induction h
Expand All @@ -15,17 +39,9 @@ theorem big_step_to_small_step_star {S : Stmt} {s t : State} (h : (S, s) ==> t)
calc
_ ⇒ (_, _) := by small_step
_ ⇒* (_, _) := by rfl
case seq S₁ T s₁ t₁ u₁ hS₁ hT hS_ih hT_ih =>
calc
_ ⇒* (skip;; T, t₁) := ?step1
_ ⇒* (_, _) := by sorry
_ ⇒* (_, _) := by small_step

case step1 =>
generalize hct : (skip, t₁) = ct
rw [hct] at hS_ih
induction hS_ih
case refl => sorry
case tail _ _ _ =>
sorry
case seq S₁ T s₁ t₁ u₁ hS₁ hT hS_ih hT_ih => calc
(S₁;; T, s₁) ⇒* (skip;; T, t₁) := smallStepStar_skip_seq hS_ih
_ ⇒ (T, t₁) := by small_step
_ ⇒* (skip, u₁) := hT_ih

all_goals sorry