fhelium.ir.dialects.logical
Operand-role logical arithmetic between semantic and CKKS IR.
Cheon-Kim-Kim-Song (CKKS) intermediate representation (IR) state is assigned after these operations record whether each value is encrypted or public.
AddEncryptedEncryptedOp
class View source
AddEncryptedEncryptedOp()Bases: _BinaryLogicalOp
Return the logical pointwise sum of encrypted values.
For logical values representing slot tensors LowerLogicalToCkksPass maps this operation to ckks.AddOp once both operands have usable CKKS state.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_logical.add.encrypted_encrypted' | |
lhs | operand_def(EncryptedType) | |
rhs | operand_def(EncryptedType) | |
result | result_def(EncryptedType) |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
AddEncryptedPublicOp
class View source
AddEncryptedPublicOp()Bases: _BinaryLogicalOp
Return the logical pointwise sum of encrypted
The result represents
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_logical.add.encrypted_public' | |
lhs | operand_def(EncryptedType) | |
rhs | operand_def(PublicType) | |
result | result_def(EncryptedType) |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
AddPublicEncryptedOp
class View source
AddPublicEncryptedOp()Bases: _BinaryLogicalOp
Return the logical pointwise sum of public
The result represents
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_logical.add.public_encrypted' | |
lhs | operand_def(PublicType) | |
rhs | operand_def(EncryptedType) | |
result | result_def(EncryptedType) |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
EncryptedType
class View source
EncryptedType()Bases: OpenStateType
Logical encrypted value before CKKS representation planning.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_logical.encrypted' | |
ROLE | ClassVar[ValueRole] | 'encrypted' |
FHEliumLogical
data View source
FHEliumLogical = Dialect('fhelium_logical', [*_LOGICAL_OPERATION_TYPES], [EncryptedType, PublicType])MultiplyEncryptedEncryptedOp
class View source
MultiplyEncryptedEncryptedOp()Bases: _BinaryLogicalOp
Return the logical pointwise product of encrypted values.
For slot tensors ckks.MultiplyOp.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_logical.multiply.encrypted_encrypted' | |
lhs | operand_def(EncryptedType) | |
rhs | operand_def(EncryptedType) | |
result | result_def(EncryptedType) |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
MultiplyEncryptedPublicOp
class View source
MultiplyEncryptedPublicOp()Bases: _BinaryLogicalOp
Multiply encrypted
The result represents
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_logical.multiply.encrypted_public' | |
lhs | operand_def(EncryptedType) | |
rhs | operand_def(PublicType) | |
result | result_def(EncryptedType) |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
MultiplyPublicEncryptedOp
class View source
MultiplyPublicEncryptedOp()Bases: _BinaryLogicalOp
Multiply public
The result represents
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_logical.multiply.public_encrypted' | |
lhs | operand_def(PublicType) | |
rhs | operand_def(EncryptedType) | |
result | result_def(EncryptedType) |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
NegateEncryptedOp
class View source
NegateEncryptedOp()Bases: _UnaryLogicalOp
Return the logical pointwise additive inverse of an encrypted value.
For a slot tensor ckks.NegateOp.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_logical.negate.encrypted' | |
value | operand_def(EncryptedType) | |
result | result_def(EncryptedType) |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
OPERATION_SPECS
constant View source
OPERATION_SPECS: tuple[OperationSpec, ...] = tuple((registered_operation_spec(operation_type, 'logical') for operation_type in _LOGICAL_OPERATION_TYPES))PublicType
class View source
PublicType()Bases: OpenStateType
Logical public value classified for an encrypted consumer.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_logical.public' | |
ROLE | ClassVar[ValueRole] | 'message' |
RollEncryptedOp
class View source
RollEncryptedOp()Bases: _UnaryLogicalOp
Apply a cyclic displacement to the encrypted slot axis.
For shift attribute torch.roll(x, r) on the selected logical dimension. CKKS lowering normalizes ckks.RotateOp. A zero normalized displacement is the identity.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_logical.roll.encrypted' | |
value | operand_def(EncryptedType) | |
result | result_def(EncryptedType) |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
SubtractEncryptedEncryptedOp
class View source
SubtractEncryptedEncryptedOp()Bases: _BinaryLogicalOp
Return the logical pointwise difference of encrypted values.
For slot tensors ckks.SubtractOp.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_logical.subtract.encrypted_encrypted' | |
lhs | operand_def(EncryptedType) | |
rhs | operand_def(EncryptedType) | |
result | result_def(EncryptedType) |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
SubtractEncryptedPublicOp
class View source
SubtractEncryptedPublicOp()Bases: _BinaryLogicalOp
Subtract public
The result represents
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_logical.subtract.encrypted_public' | |
lhs | operand_def(EncryptedType) | |
rhs | operand_def(PublicType) | |
result | result_def(EncryptedType) |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.
SubtractPublicEncryptedOp
class View source
SubtractPublicEncryptedOp()Bases: _BinaryLogicalOp
Subtract encrypted
The result represents
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium_logical.subtract.public_encrypted' | |
lhs | operand_def(PublicType) | |
rhs | operand_def(EncryptedType) | |
result | result_def(EncryptedType) |
dependencies
method
def dependencies() -> OperationDependencies: ...Describe result reads in this operation's value coordinates.