第55章 Method 的理论定义
Method 是认知任务在工程系统中的具体实现过程。
前面的章节主要解决的是:
认知系统中“有什么”。
例如:
对象
属性
状态
关系
匹配
经验
记忆
先验
偏差
目标
权重
概率
Cognitive Class
Group Class
Individual Class
这些内容构成了认知系统的结构。
但仅有结构还不够。
一个系统知道:
Object
Attribute
State
Goal
Memory
并不意味着它已经能够完成认知。
真正的问题是:
系统如何使用这些结构完成一次具体的认知任务?
这就是 Method 要解决的问题。
55.1 从 Class 到 Method
第52—54章建立了:
Cognitive Class
│
├── Group Class
│
└── Individual Class
Class 主要回答:
认知结构是什么?
而 Method 回答:
认知结构如何被使用?
因此:
Class
↓
定义认知结构
而:
Method
↓
执行认知过程
两者形成:
Cognitive Class
↓
提供结构
↓
Cognitive Method
↓
执行过程
这也是本书从认知理论进入理论工程的重要转折点。
55.2 Method 不是普通函数
在一般软件系统中,Method 通常被理解为:
输入
↓
函数
↓
输出
例如:
calculate()
完成一次计算。
但是本书中的 Cognitive Method 不能被简单等同于普通函数。
因为认知任务通常包含:
输入感知
↓
元素提取
↓
对象识别
↓
属性读取
↓
状态判断
↓
关系分析
↓
匹配
↓
权重调整
↓
概率计算
↓
认知形成
所以:
Cognitive Method 是一个具有认知语义的工程过程,而不仅仅是一段可调用代码。
55.3 Method 的基本定义
本书可以进一步正式定义:
Method 是针对特定认知任务,将认知对象、属性、状态、关系、知识、经验、规则和计算过程组织起来,并按照确定的执行逻辑产生中间结果或认知结果的工程化过程。
因此 Method 至少包含:
输入
↓
处理
↓
中间状态
↓
判断
↓
输出
但复杂的认知 Method 还可能包含:
反馈
↓
更新
↓
再次匹配
因此更完整的是:
Input
↓
Process
↓
Matching
↓
Evaluation
↓
Cognition
↓
Output
↓
Feedback
55.4 Method 的六个组成层
本书暂时把 Method 分成六个工程组成:
Method
│
├── Data Structure
├── Algorithm
├── Logic
├── Function
├── Module
└── Internal Process
这六个部分不是六种互相独立的东西。
它们是不同工程层次。
55.4.1 Data Structure
数据结构回答:
Method 操作什么?
例如认知系统可能操作:
Object
Attribute
State
Relation
Memory
Experience
Goal
Weight
Probability
这些都需要被结构化。
例如:
Object
{
identity,
attributes,
state,
relations
}
这只是一个最简单的工程表示。
真正的认知系统还需要表达:
Attribute(t)
State(t)
Relation(t)
Change(t)
因此数据结构是 Method 的基础。
55.5 Algorithm
Algorithm 回答:
Method 按什么步骤处理信息?
例如:
Input
↓
Read Object
↓
Read Attributes
↓
Read Current State
↓
Compare Knowledge
↓
Calculate Matching
↓
Apply Weight
↓
Generate Probability
↓
Generate Cognition
这就是一个认知算法的基本流程。
所以:
Data Structure
解决:
数据是什么。
而:
Algorithm
解决:
数据怎么处理。
55.6 Logic
Logic 回答:
为什么这样处理?
例如系统发现:
压力 ↑
滑移 ↑
形变 ↑
它不能只是计算数值。
还需要存在认知逻辑:
IF
压力持续增加
AND
滑移持续增加
AND
形变持续增加
THEN
对象受损风险增加
这里:
IF
AND
THEN
就是逻辑结构。
因此:
Algorithm 决定执行顺序,Logic 决定判断关系。
55.7 Function
Function 回答:
某个具体计算或操作如何被调用?
例如:
extractObject()
可以负责:
感知元素
↓
对象
又例如:
calculateMatching()
负责:
对象
+
属性
+
状态
↓
Matching
再例如:
calculateProbability()
负责:
Matching
+
Weight
↓
Probability
因此:
Method
↓
调用多个 Function
55.8 Module
当多个 Function 共同完成一个较大的认知任务时,可以形成:
Module
例如:
Matching Module
│
├── compareAttribute()
├── compareState()
├── compareRelation()
├── calculateStrength()
└── calculateWeight()
于是:
Function
↓
Module
↓
Method
形成逐渐增加的工程组织层次。
55.9 Internal Process
Internal Process 指 Method 内部真正发生的过程。
例如:
认知匹配 Method
内部可能是:
读取对象
↓
读取属性
↓
读取属性变化
↓
读取对象状态
↓
读取 Group Class
↓
读取 Individual Class
↓
计算属性匹配
↓
计算状态匹配
↓
加入个体权重
↓
生成匹配强度
↓
生成概率
↓
形成认知状态
用户调用的可能只是:
recognize()
但内部实际上执行了大量步骤。
因此:
Method 的价值不仅在于“能被调用”,更在于它隐藏并组织了一套完整的认知过程。
55.10 Method 的输入
一个 Cognitive Method 必须明确:
Input
输入可以来自:
感知
对象
属性
状态
关系
记忆
经验
先验
目标
环境
反馈
例如一个对象保护型认知 Method:
Input
│
├── Object
├── Pressure
├── Friction
├── Slip
├── Deformation
├── Time
├── Individual Goal
└── Individual Weight
这些输入进入 Method 后,才可能形成:
Risk
Matching
Cognition
55.11 Method 的输出
Method 的输出也不能只定义成:
true / false
认知系统可能产生:
Object State
Matching Score
Risk
Probability
Cognitive State
Decision Candidate
Behavior Candidate
例如:
Input
↓
Cognitive Method
↓
{
state,
matching,
risk,
probability,
cognition
}
因此:
Method 可以输出认知系统中的中间结构,而不一定直接输出最终行为。
55.12 Method 的中间状态
复杂认知不能:
Input
↓
Output
一步完成。
更合理的是:
Input
↓
Element State
↓
Object State
↓
Attribute State
↓
Matching State
↓
Cognitive State
↓
Decision State
所以 Method 必须允许存在:
Intermediate Cognitive State
这也是后面认知状态机的重要基础。
55.13 Method 与认知匹配
第18章建立了:
认知是持续匹配过程。
现在进入 Method 层,就需要把这个理论变成可执行过程。
例如:
MatchingMethod()
可以接受:
Current Object
Current Attributes
Current State
Knowledge
Goal
Memory
Weight
然后:
Current Data
↓
Attribute Matching
↓
State Matching
↓
Relation Matching
↓
Goal Matching
↓
Weight Adjustment
↓
Matching Strength
因此:
认知匹配理论提供认知原理,Matching Method 提供认知过程的工程实现。
55.14 Method 与 Individual Class
第54章建立:
Individual Class
现在 Method 可以调用它。
例如:
RecognitionMethod()
执行:
Current Perception
+
Group Class
+
Individual Class
↓
Matching
其中:
Individual Class
提供:
Experience
Memory
Prior
Bias
Goal
Weight
所以:
Method 是调用 Individual Class 参与当前认知的执行机制。
55.15 同一个 Method,不同个体
这是理论工程非常重要的一点。
可以存在同一个:
RecognitionMethod()
但是:
Individual A
和:
Individual B
调用它时使用不同的:
Individual Class
因此:
Same Method
+
Different Individual Class
↓
Different Matching
↓
Different Cognition
这意味着:
个体差异不一定要求为每个人重新编写一套算法。
只需要:
共享 Method
+
不同认知参数
即可产生不同认知。
这正是理论工程中“结构复用”的重要意义。
55.16 Method 与 Group Class
同样,一个 Method 可以调用 Group Class:
RecognitionMethod()
↓
Group Class
↓
Common Knowledge
再调用:
Individual Class
进行个体修正。
因此:
RecognitionMethod
│
├── Group Class
│
└── Individual Class
最终:
Group Knowledge
+
Individual Knowledge
↓
Current Cognition
55.17 Method 的层级
随着系统复杂度增加,可以形成:
Primitive Method
↓
Basic Method
↓
Composite Method
↓
Cognitive Method
↓
Cognitive Process
例如:
Primitive Method
readAttribute()
Basic Method
compareAttribute()
Composite Method
calculateMatching()
Cognitive Method
recognizeObjectState()
Cognitive Process
perceive
↓
match
↓
recognize
↓
decide
↓
act
因此 Method 可以形成层级组合。
55.18 Method 的组合
复杂认知任务通常不是一个 Method 独立完成的。
例如:
ObjectProtectionMethod
可以组合:
ObjectDetectionMethod
AttributeExtractionMethod
StateRecognitionMethod
RiskMatchingMethod
DecisionMethod
形成:
ObjectProtectionMethod
│
├── DetectObject()
├── ExtractAttribute()
├── RecognizeState()
├── MatchRisk()
└── GenerateDecision()
这就是:
Method Composition
也就是后面理论工程中的重要内容。
55.19 Method 与 Class 的关系
可以把两者的关系概括为:
Class = What
Method = How
也就是:
Class
回答:
“认知对象是什么?”
Method
回答:
“如何处理认知对象?”
例如:
Object Class
定义:
对象
属性
状态
关系
而:
ObjectRecognitionMethod
定义:
如何从当前感知中识别对象
因此:
Class
+
Method
才形成可以运行的认知结构。
55.20 Method 与数据结构的关系
可以建立:
Theory
↓
Data Structure
↓
Method
例如理论定义:
Object
has
Attribute
工程上需要:
Object
{
attributes[]
}
然后 Method 才能:
getAttribute()
setAttribute()
compareAttribute()
updateAttribute()
因此:
没有数据结构,Method 没有稳定的操作对象;没有 Method,数据结构只能停留在静态存储层。
55.21 Method 与算法的关系
可以进一步明确:
Algorithm
=
Method 的执行规则之一
但两者不能完全等同。
例如:
Algorithm
可以描述:
如何计算匹配强度
而:
Method
可以进一步规定:
读取什么
调用什么算法
使用什么数据
如何判断
如何更新
返回什么
所以:
Algorithm 是 Method 的计算机制,Method 是更完整的工程执行单元。
55.22 Method 与 Logic 的关系
同理:
Logic
解决:
判断关系
而:
Method
解决:
如何组织这些判断并执行任务
例如:
Logic:
IF
Slip ↑
AND
Deformation ↑
THEN
Risk ↑
Method:
ProtectObject()
内部执行:
读取 Slip
读取 Deformation
执行 Logic
计算 Risk
读取 Goal
计算 Weight
输出 Action
所以:
Logic
是认知判断的一部分
而:
Method
是认知任务的执行组织者
55.23 Method 与模块的关系
可以形成:
Function
↓
Module
↓
Method
但在大型认知系统中,也可以:
Method
↓
调用多个 Module
例如:
RecognitionMethod
│
├── PerceptionModule
├── ObjectModule
├── AttributeModule
├── MatchingModule
├── MemoryModule
└── ProbabilityModule
因此 Method 可以成为模块之间的任务编排层。
55.24 Method 的生命周期
一个完整 Method 可以具有:
Initialize
↓
Input
↓
Validate
↓
Process
↓
Match
↓
Evaluate
↓
Generate
↓
Update
↓
Output
例如:
RecognitionMethod
不是简单:
recognize(input)
而可能是:
初始化认知上下文
↓
读取当前感知
↓
验证数据
↓
建立对象候选
↓
读取属性
↓
读取状态
↓
加载 Group Class
↓
加载 Individual Class
↓
执行匹配
↓
计算权重
↓
计算概率
↓
形成认知
↓
更新状态
↓
输出结果
这才是真正意义上的认知 Method。
55.25 Method 的可组合性
一个好的 Cognitive Method 必须具有可组合性。
例如:
DetectObject()
可以被:
RecognizeObject()
调用。
而:
RecognizeObject()
又可以被:
Decision()
调用。
形成:
Detect
↓
Recognize
↓
Decide
↓
Act
因此:
Method 不是孤立函数,而是可以形成认知过程链的工程单元。
55.26 Method 的可替换性
如果理论和接口保持一致,那么内部实现可以改变。
例如:
MatchingMethod
第一版:
Rule Matching
以后可以改成:
Weighted Matching
再以后:
Dynamic Matching
甚至:
Probabilistic Matching
但只要输入输出结构保持兼容:
Input
↓
MatchingMethod
↓
Matching Result
上层认知系统就不需要全部重写。
这就是:
理论工程中的 Method 抽象。
55.27 Method 与非LLM认知工程
本书的核心理论不依赖大型语言模型。
因此 Cognitive Method 可以完全由:
数据结构
+
规则
+
算法
+
逻辑
+
状态
+
概率
组成。
例如:
DynamicMatchingMethod
可以直接根据:
Attribute
State
Change
Weight
Relation
执行计算。
不需要:
LLM
才能完成。
如果未来需要 LLM,它可以作为外部能力:
Capability Layer
而不是:
Cognitive Kernel
这一区分非常重要。
55.28 Method 的理论工程位置
到这里,全书开始形成一条完整的工程链:
Theory
↓
Concept
↓
Model
↓
Structure
↓
Class
↓
Data Structure
↓
Method
↓
Module
↓
Engine
↓
System
其中:
Class
负责组织认知结构。
Method
负责执行认知过程。
Module
负责组织功能。
Engine
负责让多个认知过程持续运行。
55.29 Method 的核心模型
本章可以建立最终模型:
Cognitive Method
│
┌──────────────────┼──────────────────┐
↓ ↓ ↓
Data Structure Algorithm Logic
│ │ │
└──────────────────┼──────────────────┘
↓
Function
↓
Module
↓
Internal Process
↓
Cognitive Result
进一步与前面的 Class 结合:
Group Class
+
Individual Class
+
Current Perception
↓
Cognitive Method
↓
Matching
↓
Cognition
↓
Decision
↓
Behavior
55.30 Method 的核心定义
因此,本书可以正式形成更严格的定义:
Cognitive Method 是认知理论在工程系统中的可执行过程单元。它以数据结构为基础,以算法和逻辑为核心,通过函数、模块及内部执行过程,对认知对象进行处理、匹配、判断、更新和输出,从而完成特定认知任务。
这个定义中的几个关键词分别对应:
数据结构 → 操作对象
算法 → 计算过程
逻辑 → 判断关系
函数 → 具体操作
模块 → 功能组织
内部过程 → 任务执行
55.31 从“认知结构”进入“认知过程”
到第54章为止,我们已经回答:
对象是什么?
属性是什么?
状态是什么?
关系是什么?
群体认知是什么?
个体认知是什么?
第55章开始回答:
这些结构如何运行?
因此理论主线发生一次重要转换:
第1—54章
↓
建立认知结构
↓
第55章
↓
建立认知过程
也就是:
从“认知是什么”进入“认知如何发生”。
55.32 本章最终结论
到这里,可以把:
Class
与:
Method
正式区分开来:
Class
↓
描述认知结构
Method
↓
执行认知任务
因此:
Cognitive Class
↓
提供认知结构
↓
Cognitive Method
↓
调用:
Object
Attribute
State
Relation
Group Class
Individual Class
Memory
Experience
Prior
Goal
Weight
↓
执行:
Algorithm
Logic
Function
Module
↓
产生:
Matching
Probability
Cognition
Decision
Behavior
最终形成:
认知理论
↓
Cognitive Class
↓
┌────────────┴────────────┐
↓ ↓
Group Class Individual Class
└────────────┬────────────┘
↓
Cognitive Method
↓
┌────────────┼────────────┐
↓ ↓ ↓
数据结构 算法 逻辑
↓ ↓ ↓
└────────────┼────────────┘
↓
函数
↓
模块
↓
内部执行过程
↓
认知结果
↓
决策
↓
行为
因此,第55章真正建立的是本书“理论工程”的一个关键分界:
Class 负责定义“认知结构”,Method 负责实现“认知过程”。
下一章 第56章 认知对象工程实现,就可以正式把前面建立的:
Object
Attribute
State
Relation
Matching
从理论概念转换为工程中的具体对象结构,并回答:
理论中的“对象、属性、状态、关系和匹配”,究竟应该如何成为系统中可以存储、读取、修改和计算的工程对象?