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}
[Semiring 𝒮]
{X Y : Type}
[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
Equations
- WeightedNetKAT.Eι WeightedNetKAT.RPol.Drop = WeightedNetKAT.Eη₂ () ()
- WeightedNetKAT.Eι wnk_rpol {skip} = WeightedNetKAT.Eη₂ () ()
- WeightedNetKAT.Eι wnk_rpol {@test ~pk} = WeightedNetKAT.Eη₂ () ()
- WeightedNetKAT.Eι wnk_rpol {@mod ~pk} = WeightedNetKAT.Eη₂ () ()
- WeightedNetKAT.Eι wnk_rpol {dup} = WeightedNetKAT.Eη₂ () (Sum.inl ())
- WeightedNetKAT.Eι wnk_rpol {~w ⨀ ~p₁} = w • WeightedNetKAT.Eι p₁
- WeightedNetKAT.Eι wnk_rpol {~p₁ ⨁ ~p₂} = Eι[WeightedNetKAT.Eι p₁,WeightedNetKAT.Eι p₂]
- WeightedNetKAT.Eι wnk_rpol {~p₁; ~q} = Eι[WeightedNetKAT.Eι p₁,0]
- WeightedNetKAT.Eι wnk_rpol {~p_2*} = Eι[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
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
def
WeightedNetKAT.croxₑ
{Pk : Type}
[Listed Pk]
{A B C Q : Type}
[AddCommMonoid Q]
[Mul Q]
[Listed A]
[Listed B]
[DecidableEq C]
[Listed C]
(l : EMatrix Pk Pk (EMatrix A B Q))
(r : EMatrix Pk Pk (EMatrix B C Q))
:
Equations
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
def
WeightedNetKAT.RPol.E𝒪_lambda
{F : Type}
[Listed F]
{N 𝒮 : Type}
[Semiring 𝒮]
[KStar 𝒮]
[Listed N]
(p : RPol 𝒮)
:
Equations
- One or more equations did not get rendered due to their size.
- WeightedNetKAT.RPol.Drop.E𝒪_lambda = 0
- wnk_rpol {skip}.E𝒪_lambda = 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 ~γ}.E𝒪_lambda = 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 ~π}.E𝒪_lambda = 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}.E𝒪_lambda = EMatrix.ofFn fun (α β : Li[Pk[F,N]]) => if α = β then WeightedNetKAT.Eη₂ (Sum.inr ()) () else 0
- wnk_rpol {~w ⨀ ~p₁}.E𝒪_lambda = EMatrix.ofFn fun (α β : Li[Pk[F,N]]) => p₁.E𝒪_lambda.getN α β
- wnk_rpol {~p₁ ⨁ ~p₂}.E𝒪_lambda = EMatrix.ofFn fun (α β : Li[Pk[F,N]]) => E𝒪_lambda[p₁.E𝒪_lambda.getN α β,p₂.E𝒪_lambda.getN α β]
Instances For
theorem
WeightedNetKAT.RPol.E𝒪_lambda_iter
{F : Type}
[Listed F]
{N 𝒮 : Type}
[Semiring 𝒮]
[KStar 𝒮]
[Listed N]
[DecidableEq N]
(p₁ : RPol 𝒮)
:
@[simp]
theorem
WeightedNetKAT.RPol.EMatrix.asMatrix_one
{X : Type u_1}
{α : Type u_2}
[Listed X]
[DecidableEq X]
[Zero α]
[One α]
:
theorem
WeightedNetKAT.RPol.E𝒪_heart_eq_𝒪_heart
{F : Type}
[Listed F]
{N 𝒮 : Type}
[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.E𝒪_lambda = EMatrix.ofMatrix₂ p.𝒪)
:
theorem
EMatrix.apply_encodeFin
{m : Type u_1}
{n : Type u_2}
{α : Type u_3}
[Listed m]
[Listed n]
{M : NMatrix (Listed.size m) (Listed.size n) α}
{i : m}
{j : n}
:
@[simp]
theorem
WeightedNetKAT.RPol.E𝒪_lambda_eq_𝒪
{F : Type}
[Listed F]
{N 𝒮 : Type}
[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.Eδ_delta
{F : Type}
[Listed F]
{N 𝒮 : Type}
[Semiring 𝒮]
[KStar 𝒮]
[Listed N]
[DecidableEq N]
(p : RPol 𝒮)
:
Equations
- One or more equations did not get rendered due to their size.
- WeightedNetKAT.RPol.Drop.Eδ_delta = EMatrix.ofFn fun (x x_1 : Li[Pk[F,N]]) => 0
- wnk_rpol {skip}.Eδ_delta = EMatrix.ofFn fun (x x_1 : Li[Pk[F,N]]) => 0
- wnk_rpol {@test ~pk}.Eδ_delta = EMatrix.ofFn fun (x x_1 : Li[Pk[F,N]]) => 0
- wnk_rpol {@mod ~pk}.Eδ_delta = EMatrix.ofFn fun (x x_1 : Li[Pk[F,N]]) => 0
- wnk_rpol {~w ⨀ ~p₁}.Eδ_delta = p₁.Eδ_delta
- wnk_rpol {~p₁ ⨁ ~p₂}.Eδ_delta = EMatrix.ofFn fun (α β : Li[Pk[F,N]]) => Eδ_delta[[p₁.Eδ_delta.getN α β,0],[0,p₂.Eδ_delta.getN α β]]
Instances For
@[simp]
theorem
WeightedNetKAT.RPol.Eδ_delta_eq_δ
{F : Type}
[Listed F]
{N 𝒮 : Type}
[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}
[Listed F]
{N 𝒮 : Type}
[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}
[Listed F]
{N 𝒮 : Type}
[Semiring 𝒮]
[OmegaCompletePartialOrder 𝒮]
[OrderBot 𝒮]
[IsPositiveOrderedAddMonoid 𝒮]
[Listed N]
[DecidableEq F]
[DecidableEq N]
[KStar 𝒮]
[LawfulKStar 𝒮]
[KStarIter 𝒮]
[MulLeftMono 𝒮]
[MulRightMono 𝒮]
[OmegaContinuousNonUnitalSemiring 𝒮]
(p : RPol 𝒮)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
structure
WeightedNetKAT.EWNKA.Precompute
{F : Type}
[Listed F]
{N 𝒮 : Type}
[Semiring 𝒮]
[Listed N]
{Q : Type}
[Listed Q]
(𝔈 : EWNKA[F,N,𝒮,Q])
:
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
theorem
WeightedNetKAT.RPol.ewnka_sem_eq_wnka_sem
{F : Type}
[Listed F]
{N 𝒮 : Type}
[Semiring 𝒮]
[OmegaCompletePartialOrder 𝒮]
[OrderBot 𝒮]
[IsPositiveOrderedAddMonoid 𝒮]
[Listed N]
[DecidableEq F]
[DecidableEq N]
[KStar 𝒮]
[LawfulKStar 𝒮]
[KStarIter 𝒮]
[MulLeftMono 𝒮]
[MulRightMono 𝒮]
[OmegaContinuousNonUnitalSemiring 𝒮]
(p : RPol 𝒮)
: