Skip to content

Commit de68443

Browse files
committed
refactor: drop redundant multi-context semantics
1 parent f2c2a92 commit de68443

1 file changed

Lines changed: 2 additions & 46 deletions

File tree

EffectSSA/ProofSketch/ProofSketch.lean

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -22,50 +22,6 @@ implies contextual equivalence, in an SSA-based rewriting setting.
2222
@[expose] public noncomputable section
2323
namespace EffectSSA.ProofSketch
2424

25-
/-!
26-
## Semantics
27-
-/
28-
section Semantics
29-
variable [SSA ι σ ν]
30-
31-
/-! #### MultiContext Semantics -/
32-
33-
/-- `HoleEnv ι n` is the type of a substitution mapping holes to instruction sequences. -/
34-
abbrev HoleEnv (ι) (n : Nat) := Hole n → InstSeq ι
35-
36-
namespace MultiContext
37-
variable (C : MultiContext ι n)
38-
39-
instance : Denote (MultiContext ι n) (HoleEnv ι n → SEnv ι → SEnv ι) where
40-
denote C η := C.foldl <| fun (ρ : SEnv ι) i =>
41-
match i with
42-
| .inl (i : Inst ι) => ⟦i⟧ ρ
43-
| .inr (h : Hole n) => ⟦η h⟧ ρ
44-
45-
theorem denote_eq : ⟦C⟧ = fun (η : HoleEnv ι n) => C.foldl (fun (ρ : SEnv ι) i =>
46-
match i with
47-
| .inl (i : Inst ι) => ⟦i⟧ ρ
48-
| .inr (h : Hole n) => ⟦η h⟧ ρ) := rfl
49-
50-
@[simp, grind =]
51-
theorem denote_nil' : ⟦([] : MultiContext ι n)⟧ η = (id : SEnv ι → SEnv ι) := rfl
52-
53-
@[simp, grind =] theorem denote_cons_inst' (i : Inst ι) :
54-
⟦(Sum.inl i :: C : MultiContext ι n)⟧ = fun η ρ => ⟦C⟧ η (⟦i⟧ ρ) := by rfl
55-
56-
@[simp, grind =] theorem denote_cons_hole' (h : Hole n) :
57-
⟦(Sum.inr h :: C : MultiContext ι n)⟧ = fun η ρ => ⟦C⟧ η (⟦η h⟧ ρ) := by rfl
58-
59-
@[simp, grind =]
60-
theorem denote_plug : ⟦C.plug I⟧ = ⟦C⟧ (I[·]) := by
61-
funext ρ
62-
induction C generalizing ρ
63-
case nil => simp
64-
case cons i C ih => cases i <;> grind
65-
66-
end MultiContext
67-
end Semantics
68-
6925
variable [SSA ι σ ν]
7026

7127
/-!
@@ -523,8 +479,7 @@ theorem Pattern.ctxRefine_of_denoteRefine (I J : Pattern ι n)
523479
suffices ∀ ρ η, ρ ⊒ η →
524480
∀ {Γ}, Invariant Γ C I ρ →
525481
∀ {Δ}, Invariant Δ C J η →
526-
⟦C⟧ (I[·]) ρ ⊒ ⟦C⟧ (J[·]) η by
527-
simp only [MultiContext.denote_plug]
482+
⟦C.plug I⟧ ρ ⊒ ⟦C.plug J⟧ η by
528483
apply @this { } { } ?_ ∅ ?_ ∅ ?_
529484
<;> grind [Invariant.initial]
530485
clear hC hCI hCJ
@@ -539,6 +494,7 @@ theorem Pattern.ctxRefine_of_denoteRefine (I J : Pattern ι n)
539494
· apply Invariant.of_invariant_cons_inst hI hCI
540495
· apply Invariant.of_invariant_cons_inst hJ hCJ
541496
| inr h =>
497+
simp only [MultiContext.plug_cons_hole, getElem_hole, InstSeq.denote_append]
542498
apply ih (⟦I[h]⟧ ρ) (⟦J[h]⟧ η)
543499
· apply h_denoteRefine
544500
· assumption

0 commit comments

Comments
 (0)