Boolean forms over supplied readout words
DefinitionAPFReachKernel_Marksapfconditional-referencereachkernel
Forms are generated by blank, crossing and placement and evaluated on a supplied family of Boolean readouts. The interface defines denotation, finite readout words, word evaluation, semantic equivalence on attained words and the attained-word set. These objects organize finite semantic information. They do not build accessible physical records or establish a general quotient Boolean-algebra or atom correspondence.
Definition code
import Definitions.Def_APFReachKernel_Ashby
namespace ReachKernel.Marks
end ReachKernel.Marks
/-
ReachKernel/Marks.lean
Boolean form semantics over a supplied readout family. Forms factor
through the same finite readout word; attained-word equivalence and a word
count are proved. Readout vectors are semantic data, not an accessible
physical record or controller. No general BooleanAlgebra quotient or atom
correspondence is constructed, and the original occupant and bill are not
identified with this algebra by these results.
-/
set_option autoImplicit false
namespace ReachKernel.Marks
/-- Spencer Brown expressions with indeterminates, as in Def_LawsOfForm_Algebra. -/
inductive Expr
| blank
| var (n : Nat)
| cross (a : Expr)
| beside (a b : Expr)
deriving DecidableEq, Repr
/-- Boolean evaluation (cross = not, beside = or, blank = false). -/
def eval (ρ : Nat → Bool) : Expr → Bool
| .blank => false
| .var n => ρ n
| .cross a => !(eval ρ a)
| .beside a b => eval ρ a || eval ρ b
/-- A form over a family of readouts, read at a state (Def_APFLawsOfForm_Bridge.denote). -/
def denote {Ω : Type} (g : Nat → Ω → Bool) (e : Expr) (x : Ω) : Bool :=
eval (fun n => g n x) e
/-- The form mentions only marks below `n`. -/
def FreeBelow (n : Nat) : Expr → Prop
| .blank => True
| .var m => m < n
| .cross a => FreeBelow n a
| .beside a b => FreeBelow n a ∧ FreeBelow n b
def decFreeBelow (n : Nat) : (e : Expr) → Decidable (FreeBelow n e)
| .blank => isTrue trivial
| .var m => inferInstanceAs (Decidable (m < n))
| .cross a => decFreeBelow n a
| .beside a b => @instDecidableAnd _ _ (decFreeBelow n a) (decFreeBelow n b)
instance (n : Nat) (e : Expr) : Decidable (FreeBelow n e) := decFreeBelow n e
/-- The readout word of a state on the first `n` marks. -/
def word {Ω : Type} (g : Nat → Ω → Bool) (n : Nat) (x : Ω) : List Bool :=
(List.range n).map (fun i => g i x)
/-- Evaluating a form on a word (missing marks read false). -/
def evalWord (w : List Bool) : Expr → Bool :=
eval (fun i => w.getD i false)
/-- Mark identity for an occupant on a challenge set: two forms are the same
mark iff they read alike at every attained state. -/
def MarkEq {Ω : Type} (g : Nat → Ω → Bool) (Ch : List Ω) (e f : Expr) : Prop :=
∀ x ∈ Ch, denote g e x = denote g f x
instance {Ω : Type} (g : Nat → Ω → Bool) (Ch : List Ω) (e f : Expr) :
Decidable (MarkEq g Ch e f) := by unfold MarkEq; infer_instance
/-- The attained words of the challenge set on the first `n` marks. -/
def attained {Ω : Type} (g : Nat → Ω → Bool) (n : Nat) (Ch : List Ω) : List (List Bool) :=
Ch.map (word g n)
end ReachKernel.Marks
Source
APF ReachKernel; original archive f05a126714fe8d24a4377f87a7e460777555e19227087abb6c18dbe2ffae959e, ReachKernel/Marks.lean; corrected compatible source manifest 2c8ccc43b416ba6e4f1b9eb02d4780b828e8dab689651eb567f7d159065cdfd2. Private conditional/reference model.