Go-specific semantics, built on the domain theory of Domains.lean/Operations.lean.
Some helpers #
noncomputable def
func
{ฮฑ : Sort u_1}
(v : (Value.๐ Store.type Channel Address Go.Typ).type)
(default : ฮฑ)
(fn : (List Address ร List Channel โ Domain Store.type Channel (Value.Send๐ Address Go.Typ) PUnit.{1}) โ ฮฑ)
:
ฮฑ
Equations
- One or more equations did not get rendered due to their size.
Instances For
noncomputable def
Domain.branches
{ฮฑ : Type u_1}
{ฮฒ : Type u_2}
{ฮ : Type u_3}
{ยซฮฃยป : Type u_4}
[IMetricSpace ฮฒ]
[IMetricSpace ยซฮฃยป]
[IMetricSpace ฮ]
[IMetricSpace ฮฑ]
[CompleteSpace ยซฮฃยป]
[CompleteSpace ฮ]
[CompleteSpace ฮฑ]
[CompleteSpace ฮฒ]
(p : Domain ยซฮฃยป ฮ ฮฑ ฮฒ)
(ฯ : ยซฮฃยป)
:
Equations
Instances For
The main semantics #
@[irreducible]
Equations
- One or more equations did not get rendered due to their size.
- Go.zero Go.Typ.bool = Value.Send๐.bool false
- Go.zero Go.Typ.int = Value.Send๐.int 0
- Go.zero Go.Typ.str = Value.Send๐.str ""
- Go.zero (key.map ฯ) = Value.Send๐.map [] ฯ true
- Go.zero ฯ.chan = Value.Send๐.chan nil ฯ nil nil
- Go.zero ฯ.slice = Value.Send๐.slice 0 0 0 nil
- Go.zero (Go.Typ.array n ฯ) = Value.Send๐.array n fun (i : Fin n) => Go.zero ฯ
- Go.zero (Go.Typ.func params returns) = sorry
- Go.zero (Go.Typ.named name args) = sorry
- Go.zero (Go.Typ.var name) = sorry
Instances For
@[implicit_reducible]
Value equality, for comparable values.
- int {n : โค} : Eq (Value.๐.int n) (Value.๐.int n)
- str {s : String} : Eq (Value.๐.str s) (Value.๐.str s)
- bool {b : Bool} : Eq (Value.๐.bool b) (Value.๐.bool b)
- chan {l : Address} {ฯ : Typ} {r b : Address} : Eq (Value.๐.chan l ฯ r b) (Value.๐.chan l ฯ r b)
- struct {fs fs' : UniformFun String (Option (Value.๐ Store.type Channel Address Typ).type)} : (โ (x : String), (fs x).isSome = true โ (fs' x).isSome = true) โ (โ (x : String) (v v' : (Value.๐ Store.type Channel Address Typ).type), x โ "_" โ fs x = some v โ fs' x = some v' โ Eq v v') โ Eq (Value.๐.struct fs) (Value.๐.struct fs')
- array {len : โ} {f f' : UniformFun (Fin len) (Value.๐ Store.type Channel Address Typ).type} : (โ (i : Fin len), Eq (f i) (f' i)) โ Eq (Value.๐.array len f) (Value.๐.array len f')
- slice {c c' l l' h h' : โ} : Eq (Value.๐.slice c l h nil) (Value.๐.slice c' l' h' nil)
- map {ฯ : Typ} : Eq (Value.๐.map (fun (x : (Value.๐ Store.type Channel Address Typ).type) => none) ฯ true) (Value.๐.map (fun (x : (Value.๐ Store.type Channel Address Typ).type) => none) ฯ true)
- func : Eq (Value.๐.func fun (x : List Address ร List Channel) => Domain.abort) (Value.๐.func fun (x : List Address ร List Channel) => Domain.abort)
Instances For
Value disequality, for comparable values.
- int {nโ nโ : โค} : nโ โ nโ โ DisEq (Value.๐.int nโ) (Value.๐.int nโ)
- str {sโ sโ : String} : sโ โ sโ โ DisEq (Value.๐.str sโ) (Value.๐.str sโ)
- bool {bโ bโ : Bool} : bโ โ bโ โ DisEq (Value.๐.bool bโ) (Value.๐.bool bโ)
- chan {l l' : Address} {ฯ : Typ} {r r' b b' : Address} : r โ r' โ DisEq (Value.๐.chan l ฯ r b) (Value.๐.chan l' ฯ r' b')
- struct {fs fs' : UniformFun String (Option (Value.๐ Store.type Channel Address Typ).type)} {x : String} {v v' : (Value.๐ Store.type Channel Address Typ).type} : (โ (x : String), (fs x).isSome = true โ (fs' x).isSome = true) โ x โ "_" โ fs x = some v โ fs' x = some v' โ DisEq v v' โ DisEq (Value.๐.struct fs) (Value.๐.struct fs')
- array {len : โ} {f f' : UniformFun (Fin len) (Value.๐ Store.type Channel Address Typ).type} {i : Fin len} : DisEq (f i) (f' i) โ DisEq (Value.๐.array len f) (Value.๐.array len f')
- slice {c c' l l' h h' : โ} {r r' : Address} : (r = nil โ r' โ nil) โ DisEq (Value.๐.slice c l h r) (Value.๐.slice c' l' h' r')
- map {f f' : UniformFun (Value.๐ Store.type Channel Address Typ).type (Option Address)} {b b' : Prop} {ฯ : Typ} : b = ยฌb' โ DisEq (Value.๐.map f ฯ (decide b)) (Value.๐.map f' ฯ (decide b'))
- func {f f' : List Address ร List Channel โ Domain Store.type Channel (Value.Send๐ Address Typ) PUnit.{1}} : ((f = fun (x : List Address ร List Channel) => Domain.abort) โ f' โ fun (x : List Address ร List Channel) => Domain.abort) โ DisEq (Value.๐.func f) (Value.๐.func f')
Instances For
noncomputable def
Go.updateRefs
(addrs : List Address)
(vs : List (Value.๐ Store.type Channel Address Typ).type)
(idxs : List (List ((Value.๐ Store.type Channel Address Typ).type โ String)))
(ฯ : Store.type)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
noncomputable def
Go.for_seq_F
(e : Domain Store.type Channel (Value.Send๐ Address Typ) (Value.๐ Store.type Channel Address Typ).type)
(P' P : Domain Store.type Channel (Value.Send๐ Address Typ) PUnit.{u_1 + 1})
:
Equations
- Go.for_seq_F e P' P = ((P.seq' P').seq' (Go.guard true e)).choice ((Domain.pure PUnit.unit).seq' (Go.guard false e))
Instances For
def
Go.for_seq
(e : Domain Store.type Channel (Value.Send๐ Address Typ) (Value.๐ Store.type Channel Address Typ).type)
(P : Domain Store.type Channel (Value.Send๐ Address Typ) PUnit.{u_1 + 1})
:
Equations
- Go.for_seq e P 0 = Domain.branch fun (ฯ : Store.type) => {Branch.next ฯ { val := Domain.pure PUnit.unit }}
- Go.for_seq e P i.succ = Go.for_seq_F e P (Go.for_seq e P i)
Instances For
@[irreducible]
Equations
- One or more equations did not get rendered due to their size.
- Go.Expression.denotation out ฮพ ฯ (Go.Expression.nat n) = Domain.pure (Value.๐.int n.toInt!)
- Go.Expression.denotation out ฮพ ฯ (Go.Expression.str s) = Domain.pure (Value.๐.str s)
- Go.Expression.denotation out ฮพ ฯ Go.Expression.true = Domain.pure (Value.๐.bool true)
- Go.Expression.denotation out ฮพ ฯ Go.Expression.false = Domain.pure (Value.๐.bool false)
- Go.Expression.denotation out ฮพ ฯ (Go.Expression.make ฯ es) = sorry
Instances For
@[irreducible]
def
Go.Expression.denotations
(out : Channel)
(ฮพ : List Channel)
(ฯ : String โ Option Channel)
:
Equations
- One or more equations did not get rendered due to their size.
- Go.Expression.denotations out ฮพ ฯ [] = Domain.pure []
Instances For
@[irreducible]
Equations
- One or more equations did not get rendered due to their size.
- Go.evalRef out ฮพ ฯ Go.Ref.wildcard = Domain.branch fun (ฯ : Store.type) => {Branch.next ฯ { val := Domain.pure (none, []) }}
Instances For
@[irreducible]
Equations
- One or more equations did not get rendered due to their size.
- Go.evalRefs out ฮพ ฯ [] = Domain.pure []
Instances For
@[irreducible]
Equations
- One or more equations did not get rendered due to their size.
- Go.Statement.denotation out ฮพ ฯ [] = Domain.branch fun (ฯ : Store.type) => {Branch.next ฯ { val := Domain.pure PUnit.unit }}
- Go.Statement.denotation out ฮพ ฯ (Go.Statement.skip :: ss) = (Go.Statement.denotation out ฮพ ฯ ss).seq' (Domain.branch fun (ฯ : Store.type) => {Branch.next ฯ { val := Domain.pure PUnit.unit }})
- Go.Statement.denotation out [] ฯ [Go.Statement.return es] = Domain.branch fun (ฯ : Store.type) => {Branch.next ฯ { val := Domain.abort }}
- Go.Statement.denotation out ฮพ ฯ (Go.Statement.return es :: ss) = Domain.branch fun (ฯ : Store.type) => {Branch.next ฯ { val := Domain.abort }}
Instances For
@[irreducible]
def
Go.Statement.denotation.go
(out : Channel)
(ฮพ : List Channel)
(ฯ : String โ Option Channel)
(v : (Value.๐ Store.type Channel Address Typ).type)
(pโ : Domain Store.type Channel (Value.Send๐ Address Typ) PUnit.{1})
:
Equations
- One or more equations did not get rendered due to their size.
- Go.Statement.denotation.go out ฮพ ฯ v pโ [] = pโ
Instances For
theorem
Go.guard.is_branch
{e : Domain Store.type Channel (Value.Send๐ Address Typ) (Value.๐ Store.type Channel Address Typ).type}
:
โ (f :
UniformFun Store.type
(Set
(Branch Store.type Channel (Value.Send๐ Address Typ)
(Domain Store.type Channel (Value.Send๐ Address Typ) PUnit.{u_1 + 1})))),
guard true e = Domain.branch f
theorem
Go.for_seq_F_nonexpansive
{e : Domain Store.type Channel (Value.Send๐ Address Typ) (Value.๐ Store.type Channel Address Typ).type}
{q : Domain Store.type Channel (Value.Send๐ Address Typ) PUnit.{u_1 + 1}}
(p p' : Domain Store.type Channel (Value.Send๐ Address Typ) PUnit.{u_1 + 1})
:
theorem
Go.for_seq_F_contracting
{e : Domain Store.type Channel (Value.Send๐ Address Typ) (Value.๐ Store.type Channel Address Typ).type}
{q : Domain Store.type Channel (Value.Send๐ Address Typ) PUnit.{u_1 + 1}}
:
ContractingWith (1 / 2) (for_seq_F e q)
theorem
Go.for_seq_eq
{out : Channel}
{ฮพ : List Channel}
{ฯ : String โ Option Channel}
{e : Domain Store.type Channel (Value.Send๐ Address Typ) (Value.๐ Store.type Channel Address Typ).type}
{S : List ComputableGo.Statement}
{n : โ}
:
for_seq e (Statement.denotation out ฮพ ฯ S) n = (for_seq_F e (Statement.denotation out ฮพ ฯ S))^[n]
(Domain.branch fun (ฯ : Store.type) => {Branch.next ฯ { val := Domain.pure PUnit.unit }})
theorem
Go.for_seq_cauchy'
{out : Channel}
(ฮพ : List Channel)
(ฯ : String โ Option Channel)
(e : Domain Store.type Channel (Value.Send๐ Address Typ) (Value.๐ Store.type Channel Address Typ).type)
(S : List ComputableGo.Statement)
:
โ (p : Domain Store.type Channel (Value.Send๐ Address Typ) PUnit.{1}),
(Filter.map (for_seq e (Statement.denotation out ฮพ ฯ S)) Filter.atTop).lim = p