Restricting and resizing the directions of a context
Lax369799.ContextPorts · concepts/Lax369799/ContextPorts.lean · lax-369799
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural Language Statement
Theorem
Select the hole's successors using a map from new directions to old ones, change the hole rank, and restrict to reachable vertices. The hole remains reachable because its first visit uses no outgoing hole edge. Substitution into this context is isomorphic to renaming the argument's outputs before insertion into the original context.
Concept map
Evidence
Lean source view on GitHub
| 1 | import Lax369799.ContextRelabelling |
| 2 | import Lax369799.SupportPorts |
| 3 | |
| 4 | /-! |
| 5 | --- |
| 6 | title: Restricting and resizing the directions of a context |
| 7 | type: theorem |
| 8 | --- |
| 9 | Select the hole's successors using a map from new directions to old |
| 10 | ones, change the hole rank, and restrict to reachable vertices. The |
| 11 | hole remains reachable because its first visit uses no outgoing hole |
| 12 | edge. Substitution into this context is isomorphic to renaming the |
| 13 | argument's outputs before insertion into the original context. |
| 14 | -/ |
| 15 | |
| 16 | namespace Lax369799.ContextPorts |
| 17 | open RankedSystems Flattening |
| 18 | |
| 19 | /-- Change the hole's rank and retain every ordinary symbol. -/ |
| 20 | def resizeSymbol {A : RankedSet} {m : ℕ} (k : ℕ) : Symbol (WithHole A m) → Symbol (WithHole A k) |
| 21 | | ⟨r,.inl a⟩ => ⟨r,.inl a⟩ |
| 22 | | ⟨_,.inr _⟩ => ⟨k,.inr ⟨rfl⟩⟩ |
| 23 | |
| 24 | noncomputable def resizeGraph {A : RankedSet} {m k : ℕ} (C : SetContext A m 0) |
| 25 | (s : Fin k → Fin m) : Presentation (WithHole A k) 0 C.system.Vertex := by |
| 26 | classical |
| 27 | exact { |
| 28 | label := fun v => resizeSymbol k (C.system.graph.label v) |
| 29 | initial := C.system.graph.initial |
| 30 | root := C.system.graph.root |
| 31 | edge := fun v d t => if IsHole (C.system.graph.label v) then |
| 32 | ∃ i : Fin k,d = i.val ∧ C.system.graph.edge v (s i).val t |
| 33 | else C.system.graph.edge v d t |
| 34 | direction_valid := by |
| 35 | intro v d t ht |
| 36 | cases hlabel : C.system.graph.label v with |
| 37 | | mk r a => |
| 38 | cases a with |
| 39 | | inl a => |
| 40 | have hn : ¬IsHole (C.system.graph.label v) := by |
| 41 | rw [hlabel]; rintro ⟨e,he⟩; cases he |
| 42 | rw [if_neg hn] at ht |
| 43 | have hd := C.system.graph.direction_valid v d t ht |
| 44 | rw [hlabel] at hd |
| 45 | simpa only [hlabel,resizeSymbol] using hd |
| 46 | | inr e => |
| 47 | have hh : IsHole (C.system.graph.label v) := by rw [hlabel]; exact ⟨e,rfl⟩ |
| 48 | rw [if_pos hh] at ht |
| 49 | obtain ⟨i,rfl,_⟩ := ht |
| 50 | simpa only [hlabel,resizeSymbol] using i.isLt } |
| 51 | |
| 52 | axiom resize_exists {A : RankedSet} {m k : ℕ} (C : SetContext A m 0) |
| 53 | (hC : C.system.Deterministic) (s : Fin k → Fin m) : |
| 54 | ∃ D : SetContext A k 0, D.system = trim (resizeGraph C s) ∧ D.system.Deterministic |
| 55 | |
| 56 | axiom plug_resize {A : RankedSet} {m k : ℕ} (C : SetContext A m 0) |
| 57 | (hC : C.system.Deterministic) (s : Fin k → Fin m) (R : System A k) |
| 58 | (D : SetContext A k 0) (hD : D.system = trim (resizeGraph C s)) |
| 59 | (U V : System A 0) (hU : U.val = plug C (Renaming.renameSystem s R).val) |
| 60 | (hV : V.val = plug D R.val) : Morphisms.Isomorphic U.val V.val |
| 61 | |
| 62 | end Lax369799.ContextPorts |
| 63 |
From Mathlib
none
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments