Equations
- One or more equations did not get rendered due to their size.
Instances For
structure
WeightedNetKAT.EWNKA
(F : Type u_4)
(N : Type u_5)
(𝒮 : Type u_6)
(Q : Type u_7)
[Semiring 𝒮]
[Listed F]
[Listed N]
[Listed Q]
:
Type u_6
An efficient version of [WNKA] that uses explicit matrices.
ιis the initial weightings.δis a family of transition functionsδ[α,β] : Q → 𝒞 𝒮 Qindexed by packet pairs.𝒪is a family of output weightings𝒪[α,β] : 𝒞 𝒮 Qindexed by packet pairs. Note that we use 𝒪 instead of λ, since λ is the function symbol in Lean.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[reducible, inline]
abbrev
WeightedNetKAT.Eη₂
{𝒮 : Type u_3}
[Semiring 𝒮]
{X : Type u_4}
{Y : Type u_5}
[instX : Listed X]
[instY : Listed Y]
(i : X)
(j : Y)
:
EMatrix X Y 𝒮
Equations
- WeightedNetKAT.Eη₂ i j = EMatrix.ofFn fun (i' : Li[X]) (j' : Li[Y]) => if Listed.encode i = ↑i' ∧ Listed.encode j = ↑j' then 1 else 0
Instances For
def
WeightedNetKAT.EC
{F : Type u_1}
[Listed F]
{N : Type u_2}
{𝒮 : Type u_3}
[Semiring 𝒮]
(p : RPol 𝒮)
:
Equations
- WeightedNetKAT.EC WeightedNetKAT.RPol.Drop = WeightedNetKAT.Eη₂ () ()
- WeightedNetKAT.EC wnk_rpol {skip} = WeightedNetKAT.Eη₂ () ()
- WeightedNetKAT.EC wnk_rpol {@test ~pk} = WeightedNetKAT.Eη₂ () ()
- WeightedNetKAT.EC wnk_rpol {@mod ~pk} = WeightedNetKAT.Eη₂ () ()
- WeightedNetKAT.EC wnk_rpol {dup} = WeightedNetKAT.Eη₂ () (Sum.inl ())
- WeightedNetKAT.EC wnk_rpol {~w ⨀ ~p₁} = w • WeightedNetKAT.EC p₁
- WeightedNetKAT.EC wnk_rpol {~p₁ ⨁ ~p₂} = EC[WeightedNetKAT.EC p₁,WeightedNetKAT.EC p₂]
- WeightedNetKAT.EC wnk_rpol {~p₁; ~q} = EC[WeightedNetKAT.EC p₁,0]
- WeightedNetKAT.EC wnk_rpol {~p_2*} = EC[0,1]
Instances For
Equations
- WeightedNetKAT.«term_⊠ₑ_» = Lean.ParserDescr.trailingNode `WeightedNetKAT.«term_⊠ₑ_» 50 51 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ⊠ₑ ") (Lean.ParserDescr.cat `term 50))
Instances For
@[simp]
Equations
- WeightedNetKAT.«term_⊡ₑ_» = Lean.ParserDescr.trailingNode `WeightedNetKAT.«term_⊡ₑ_» 50 51 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ⊡ₑ ") (Lean.ParserDescr.cat `term 50))
Instances For
Equations
- WeightedNetKAT.«term_⊟ₑ_» = Lean.ParserDescr.trailingNode `WeightedNetKAT.«term_⊟ₑ_» 50 51 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ⊟ₑ ") (Lean.ParserDescr.cat `term 50))
Instances For
Equations
- WeightedNetKAT.«term_⊟'ₑ_» = Lean.ParserDescr.trailingNode `WeightedNetKAT.«term_⊟'ₑ_» 50 51 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ⊟'ₑ ") (Lean.ParserDescr.cat `term 50))
Instances For
Equations
- WeightedNetKAT.«term_⊞ₑ_» = Lean.ParserDescr.trailingNode `WeightedNetKAT.«term_⊞ₑ_» 50 51 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ⊞ₑ ") (Lean.ParserDescr.cat `term 50))
Instances For
@[simp]
theorem
WeightedNetKAT.croxₑ_eq_crox
{Pk : Type u_4}
[Listed Pk]
{A : Type u_5}
{B : Type u_6}
{C : Type u_7}
{Q : Type u_8}
[AddCommMonoid Q]
[Mul Q]
[Listed A]
[Listed B]
[Listed C]
[Fintype A]
[Fintype B]
[Fintype C]
[Fintype Pk]
(l : EMatrix Pk Pk (EMatrix A B Q))
(r : EMatrix Pk Pk (EMatrix B C Q))
:
def
WeightedNetKAT.RPol.ER
{F : Type u_1}
[Listed F]
{N : Type u_2}
{𝒮 : Type u_3}
[Semiring 𝒮]
[KStar 𝒮]
[Listed N]
(p : RPol 𝒮)
:
Equations
- One or more equations did not get rendered due to their size.
- WeightedNetKAT.RPol.Drop.ER = 0
- wnk_rpol {skip}.ER = EMatrix.ofFn fun (α β : Li[Pk[F,N]]) => if α = β then EMatrix.ofFn fun (x : Li[WeightedNetKAT.S wnk_rpol {skip}]) => 1 else 0
- wnk_rpol {@test ~γ}.ER = EMatrix.ofFn fun (α β : Li[Pk[F,N]]) => if α = β ∧ ↑β = Listed.encode γ then EMatrix.ofFn fun (x : Li[WeightedNetKAT.S wnk_rpol {@test ~γ}]) => 1 else 0
- wnk_rpol {@mod ~π}.ER = EMatrix.ofFn fun (x β : Li[Pk[F,N]]) => if ↑β = Listed.encode π then EMatrix.ofFn fun (x : Li[WeightedNetKAT.S wnk_rpol {@mod ~π}]) => 1 else 0
- wnk_rpol {dup}.ER = EMatrix.ofFn fun (α β : Li[Pk[F,N]]) => if α = β then WeightedNetKAT.Eη₂ (Sum.inr ()) () else 0
- wnk_rpol {~w ⨀ ~p₁}.ER = EMatrix.ofFn fun (α β : Li[Pk[F,N]]) => p₁.ER.getN α β
- wnk_rpol {~p₁ ⨁ ~p₂}.ER = EMatrix.ofFn fun (α β : Li[Pk[F,N]]) => ER[p₁.ER.getN α β,p₂.ER.getN α β]
Instances For
theorem
WeightedNetKAT.RPol.ER_iter
{F : Type u_1}
[Listed F]
{N : Type u_2}
{𝒮 : Type u_3}
[Semiring 𝒮]
[KStar 𝒮]
[Listed N]
[DecidableEq N]
(p₁ : RPol 𝒮)
:
@[simp]
theorem
WeightedNetKAT.RPol.EMatrix.asMatrix_one
{X : Type u_4}
{α : Type u_5}
[Listed X]
[DecidableEq X]
[Zero α]
[One α]
:
theorem
WeightedNetKAT.RPol.ER_heart_eq_𝒪_heart
{F : Type u_1}
[Listed F]
{N : Type u_2}
{𝒮 : Type u_3}
[Semiring 𝒮]
[OmegaCompletePartialOrder 𝒮]
[OrderBot 𝒮]
[IsPositiveOrderedAddMonoid 𝒮]
[KStar 𝒮]
[DecidableEq F]
[Listed N]
[DecidableEq N]
[LawfulKStar (NMatrix (Listed.size Pk[F,N]) (Listed.size Pk[F,N]) 𝒮)]
{p : RPol 𝒮}
(h : p.ER = EMatrix.ofMatrix₂ p.𝒪)
:
theorem
EMatrix.apply_encodeFin
{m : Type u_4}
{n : Type u_5}
{α : Type u_6}
[Listed m]
[Listed n]
{M : NMatrix (Listed.size m) (Listed.size n) α}
{i : m}
{j : n}
:
@[simp]
theorem
WeightedNetKAT.RPol.ER_eq_C
{F : Type u_1}
[Listed F]
{N : Type u_2}
{𝒮 : Type u_3}
[Semiring 𝒮]
[OmegaCompletePartialOrder 𝒮]
[OrderBot 𝒮]
[IsPositiveOrderedAddMonoid 𝒮]
[KStar 𝒮]
[DecidableEq F]
[Listed N]
[DecidableEq N]
[LawfulKStar (NMatrix (Listed.size Pk[F,N]) (Listed.size Pk[F,N]) 𝒮)]
{p : RPol 𝒮}
:
def
WeightedNetKAT.RPol.EB
{F : Type u_1}
[Listed F]
{N : Type u_2}
{𝒮 : Type u_3}
[Semiring 𝒮]
[KStar 𝒮]
[Listed N]
[DecidableEq N]
(p : RPol 𝒮)
:
Equations
- One or more equations did not get rendered due to their size.
- WeightedNetKAT.RPol.Drop.EB = EMatrix.ofFn fun (x x_1 : Li[Pk[F,N]]) => 0
- wnk_rpol {skip}.EB = EMatrix.ofFn fun (x x_1 : Li[Pk[F,N]]) => 0
- wnk_rpol {@test ~pk}.EB = EMatrix.ofFn fun (x x_1 : Li[Pk[F,N]]) => 0
- wnk_rpol {@mod ~pk}.EB = EMatrix.ofFn fun (x x_1 : Li[Pk[F,N]]) => 0
- wnk_rpol {dup}.EB = EMatrix.ofFn fun (α β : Li[Pk[F,N]]) => EMatrix.ofFn fun (s : Li[WeightedNetKAT.S wnk_rpol {dup}]) => if s = 0 ∧ α = β then WeightedNetKAT.η₁ 1 else 0
- wnk_rpol {~w ⨀ ~p₁}.EB = p₁.EB
- wnk_rpol {~p₁ ⨁ ~p₂}.EB = EMatrix.ofFn fun (α β : Li[Pk[F,N]]) => EB[[p₁.EB.getN α β,0],[0,p₂.EB.getN α β]]
Instances For
@[simp]
theorem
WeightedNetKAT.RPol.EB_eq_δ
{F : Type u_1}
[Listed F]
{N : Type u_2}
{𝒮 : Type u_3}
[Semiring 𝒮]
[OmegaCompletePartialOrder 𝒮]
[OrderBot 𝒮]
[IsPositiveOrderedAddMonoid 𝒮]
[KStar 𝒮]
[DecidableEq F]
[Listed N]
[DecidableEq N]
[LawfulKStar (NMatrix (Listed.size Pk[F,N]) (Listed.size Pk[F,N]) 𝒮)]
{p : RPol 𝒮}
:
@[simp]
theorem
WeightedNetKAT.RPol.wnka_toEWNKA
{F : Type u_1}
[Listed F]
{N : Type u_2}
{𝒮 : Type u_3}
[Semiring 𝒮]
[OmegaCompletePartialOrder 𝒮]
[OrderBot 𝒮]
[IsPositiveOrderedAddMonoid 𝒮]
[Listed N]
[DecidableEq F]
[DecidableEq N]
[KStar 𝒮]
[LawfulKStar 𝒮]
[KStarIter 𝒮]
[MulLeftMono 𝒮]
[MulRightMono 𝒮]
[OmegaContinuousNonUnitalSemiring 𝒮]
(p : RPol 𝒮)
:
@[simp]
theorem
WeightedNetKAT.RPol.ewnka_toWNKA
{F : Type u_1}
[Listed F]
{N : Type u_2}
{𝒮 : Type u_3}
[Semiring 𝒮]
[OmegaCompletePartialOrder 𝒮]
[OrderBot 𝒮]
[IsPositiveOrderedAddMonoid 𝒮]
[Listed N]
[DecidableEq F]
[DecidableEq N]
[KStar 𝒮]
[LawfulKStar 𝒮]
[KStarIter 𝒮]
[MulLeftMono 𝒮]
[MulRightMono 𝒮]
[OmegaContinuousNonUnitalSemiring 𝒮]
(p : RPol 𝒮)
:
structure
WeightedNetKAT.EWNKA.Precompute
{F : Type u_1}
[Listed F]
{N : Type u_2}
{𝒮 : Type u_3}
[Semiring 𝒮]
[Listed N]
{Q : Type u_4}
[Listed Q]
(𝔈 : EWNKA[F,N,𝒮,Q])
:
Type (max u_2 u_3)
Stores partial computation of the weight of a trace.
We want to compute the prefix as little as possible, and reuse it the final computation with 𝒪.
This structure turned out to be crucial for performance, as Lean would push the computation of the
prefix into the lambda where the final β was given, leading it to recomputing the prefix for every
final packet.
This gives roughly a |Pk[F,N]| times speed up.
Instances For
@[noinline, specialize #[]]
def
WeightedNetKAT.EWNKA.semArray_aux
{F : Type u_1}
[Listed F]
{N : Type u_2}
{𝒮 : Type u_3}
[Semiring 𝒮]
[Listed N]
{Q : Type u_4}
[Listed Q]
(𝒜 : EWNKA[F,N,𝒮,Q])
(α_xs : Array Pk[F,N])
(h : 0 < α_xs.size)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
theorem
WeightedNetKAT.RPol.ewnka_sem_eq_wnka_sem
{F : Type u_1}
[Listed F]
{N : Type u_2}
{𝒮 : Type u_3}
[Semiring 𝒮]
[OmegaCompletePartialOrder 𝒮]
[OrderBot 𝒮]
[IsPositiveOrderedAddMonoid 𝒮]
[Listed N]
[DecidableEq F]
[DecidableEq N]
[KStar 𝒮]
[LawfulKStar 𝒮]
[KStarIter 𝒮]
[MulLeftMono 𝒮]
[MulRightMono 𝒮]
[OmegaContinuousNonUnitalSemiring 𝒮]
(p : RPol 𝒮)
: