Cairn · module

Cairn.Claims.Registry

lean/Cairn/Claims/Registry.lean

The claim registry: an environment extension holding one entry per claim declared by the claim commands, in this module and every module it imports. The commands consult it for the compile-time checks; lake exe ledger and lake exe claims read it from the imported environment.

Compile time only (imports Lean); see Cairn.Claims for why that matters.

Imports Lean, Cairn.Claim

Order

Structures 2

structure

Cairn.Claims.Entry

lean/Cairn/Claims/Registry.lean:42
Entry : Type

One claim as the registry records it.

Fields
info : ClaimInfo
scope : String

The package scope the claim was declared in (cairn.claims.scope).

ns : Lean.Name

The namespace the claim was declared in; claims% and moves% collect by it.

decl : Lean.Name

The declaration holding the claim (a Move, Flow, Invariant, Assumption, Place, or a bare ClaimInfo for a retired id).

infoDecl : Lean.Name

The ClaimInfo constant.

module : Lean.Name
statement : Array Lean.Name

Declarations whose definitions are the claim's formal statement. The ledger hashes them (and what they unfold to in Cairn's own modules) to notice a change of meaning.

evidence : Array (String × Lean.Name)

The evidence: a role (sound press, reaches, step, …) and the theorem proving it.

triggers : Array String

Moves: the triggers answered, and whether controls are keyed.

keyed : Bool
passes : Array ClaimId

Flows: the claim ids of the moves the witness passes through, in order.

machine : Option Lean.Name

Flows and invariants: the machine they are stated against.

check : Option String

Assumptions: the runnable check that gathers evidence for it (a check name in the trusted fuzzer's report, build/fuzz/trusted.json; docs/fuzz.md, "Trusted base").

Instances

Inhabited

structure

Cairn.Claims.State

lean/Cairn/Claims/Registry.lean:77
State : Type
Fields
byId : Std.HashMap (String × ClaimId) Entry

By scope and id.

clashes : Array (Entry × Entry)

Pairs of imported claims with the same id (modules that never import each other).

here : Array Entry

Entries declared in this module, in order.

Instances

Inhabited

Definitions 14

opaque

Cairn.Claims.cairn.claims.scope

lean/Cairn/Claims/Registry.lean:24
scope : Lean.Option String

The package whose claims a module declares: ^301 in a module built with scope yap is the claim yap^301. Ids are unique within a scope, never across scopes, so a package's ids are its own and the ids of the packages it depends on can't collide with them. Set once per package, in its lakefile: leanOptions := #[⟨weak.cairn.claims.scope, "yap"⟩] (weak., because Lake passes it to every module, including those that don't import the claim commands). Cairn's own modules use the default, cairn`.

def

Cairn.Claims.scopedRef

lean/Cairn/Claims/Registry.lean:30
scopedRef (scope : String) (id : ClaimId) : String

A claim's full name, scope^N (cairn^1005, yap^301).

def

Cairn.ClaimKind.name

lean/Cairn/Claims/Registry.lean:32
name : ClaimKind → String
def

Cairn.ClaimKind.ofName?

lean/Cairn/Claims/Registry.lean:36
ofName? : String → Option ClaimKind
def

Cairn.Claims.Entry.ref

lean/Cairn/Claims/Registry.lean:72
ref (e : Entry) : String

scope^N.

def

Cairn.Claims.Entry.label

lean/Cairn/Claims/Registry.lean:74
label (e : Entry) : String
def

Cairn.Claims.State.add

lean/Cairn/Claims/Registry.lean:86
add (st : State) (e : Entry) : State
opaque

Cairn.Claims.registry

lean/Cairn/Claims/Registry.lean:91
registry : Lean.SimplePersistentEnvExtension Entry State
opaque

Cairn.Claims.sealedExt

lean/Cairn/Claims/Registry.lean:100
sealedExt : Lean.EnvExtension (Lean.NameSet × Lean.NameSet)

Namespaces collected in this module by moves% (first) and claims% (second). A move declared in the first afterwards would never be dispatched, and a claim declared in the second would be missing from the app's claims, so the commands refuse both.

def

Cairn.Claims.Entry.lt

lean/Cairn/Claims/Registry.lean:103
lt (a b : Entry) : Bool

Order by scope, then id.

def

Cairn.Claims.entries

lean/Cairn/Claims/Registry.lean:107
entries (env : Lean.Environment) : Array Entry

Every claim in every scope, by scope and then id.

def

Cairn.Claims.lookup?

lean/Cairn/Claims/Registry.lean:111
lookup? (env : Lean.Environment) (scope : String) (id : ClaimId) : Option Entry
def

Cairn.Claims.clashes

lean/Cairn/Claims/Registry.lean:114
clashes (env : Lean.Environment) : Array (Entry × Entry)
def

Cairn.Claims.allEntries

lean/Cairn/Claims/Registry.lean:117
allEntries (env : Lean.Environment) : Array Entry

Every entry, including both sides of any clash, for tools that report on the whole set.

Instances 2

instance

Cairn.Claims.instInhabitedEntry

lean/Cairn/Claims/Registry.lean:69
instInhabitedEntry : Inhabited Entry
instance

Cairn.Claims.instInhabitedState

lean/Cairn/Claims/Registry.lean:84
instInhabitedState : Inhabited State