File tree Expand file tree Collapse file tree 2 files changed +38
-21
lines changed Expand file tree Collapse file tree 2 files changed +38
-21
lines changed Original file line number Diff line number Diff line change @@ -278,6 +278,39 @@ Our new relations can be converted back to the old ones by just forgetting the e
278
278
≅[]→≅ (A⊆[f]B , B⊆[f⁻¹]A) = ⊆[]→⊆ A⊆[f]B , ⊆[]→⊆ B⊆[f⁻¹]A
279
279
```
280
280
281
+
282
+ As Agda implements constructive logic, the converse is also possible.
283
+ ``` agda
284
+ ∈-index : ∀ {I : Set iℓ} {A : IndexedSet I} {a : Carrier}
285
+ → a ∈ A
286
+ → I
287
+ ∈-index (i , eq) = i
288
+
289
+ ∈→∈[] : ∀ {I : Set iℓ} {A : IndexedSet I} {a : Carrier}
290
+ → (p : a ∈ A)
291
+ ----------
292
+ → a ≈ A (∈-index p)
293
+ ∈→∈[] (i , eq) = eq
294
+
295
+ ⊆-index : ∀ {I : Set iℓ} {J : Set jℓ} {A : IndexedSet I} {B : IndexedSet J}
296
+ → A ⊆ B
297
+ → I → J
298
+ ⊆-index A⊆B i = ∈-index (A⊆B i)
299
+
300
+ ⊆→⊆[] : ∀ {I : Set iℓ} {J : Set jℓ} {A : IndexedSet I} {B : IndexedSet J}
301
+ → (subset : A ⊆ B)
302
+ -----------
303
+ → A ⊆[ ⊆-index subset ] B
304
+ ⊆→⊆[] A⊆B i = proj₂ (A⊆B i)
305
+
306
+ ≅→≅[] : ∀ {I : Set iℓ} {J : Set jℓ} {A : IndexedSet I} {B : IndexedSet J}
307
+ → (eq : A ≅ B)
308
+ -----------------
309
+ → A ≅[ ⊆-index (proj₁ eq) ][ ⊆-index (proj₂ eq) ] B
310
+ ≅→≅[] (A⊆B , B⊆A) = (⊆→⊆[] A⊆B) , (⊆→⊆[] B⊆A)
311
+ ```
312
+
313
+
281
314
If two indexed sets are pointwise equal, they are equivelent in terms of the identify function because
282
315
indices do not have to be translated.
283
316
Original file line number Diff line number Diff line change @@ -179,31 +179,15 @@ compiler-from-expressiveness : ∀ {L M : VariabilityLanguage V}
179
179
→ LanguageCompiler L M
180
180
compiler-from-expressiveness {L} {M} exp = record
181
181
{ compile = proj₁ ∘ exp
182
- ; config-compiler = λ e → record { to = conf e ; from = fnoc e }
183
- ; preserves = λ e → ⊆-conf e , ⊆-fnoc e
182
+ ; config-compiler = λ e → record
183
+ { to = ⊆-index (proj₁ (proj₂ (exp e)))
184
+ ; from = ⊆-index (proj₂ (proj₂ (exp e)))
185
+ }
186
+ ; preserves = ≅→≅[] ∘ proj₂ ∘ exp
184
187
}
185
188
where
186
- ⟦_⟧₁ = Semantics L
187
- ⟦_⟧₂ = Semantics M
188
189
open import Data.EqIndexedSet
189
190
190
- conf : ∀ {A} → Expression L A → Config L → Config M
191
- conf e c₁ = proj₁ (proj₁ (proj₂ (exp e)) c₁)
192
-
193
- fnoc : ∀ {A} → Expression L A → Config M → Config L
194
- fnoc e c₂ = proj₁ (proj₂ (proj₂ (exp e)) c₂)
195
-
196
- eq : ∀ {A} → (e : Expression L A) → ⟦ e ⟧₁ ≅ ⟦ proj₁ (exp e) ⟧₂
197
- eq e = proj₂ (exp e)
198
-
199
- ⊆-conf : ∀ {A} → (e : Expression L A) → ⟦ e ⟧₁ ⊆[ conf e ] ⟦ proj₁ (exp e) ⟧₂
200
- ⊆-conf e with eq e
201
- ... | ⊆ , _ = proj₂ ∘ ⊆
202
-
203
- ⊆-fnoc : ∀ {A} → (e : Expression L A) → ⟦ proj₁ (exp e) ⟧₂ ⊆[ fnoc e ] ⟦ e ⟧₁
204
- ⊆-fnoc e with eq e
205
- ... | _ , ⊇ = proj₂ ∘ ⊇
206
-
207
191
{-|
208
192
When M is not at least as expressive as L,
209
193
then L can never be compiled to M.
You can’t perform that action at this time.
0 commit comments