jf_relation/gates/
logic.rs1use super::Gate;
10use crate::constants::{GATE_WIDTH, N_MUL_SELECTORS};
11use ark_ff::Field;
12
13#[derive(Clone)]
15pub struct LogicOrGate;
16
17impl<F> Gate<F> for LogicOrGate
18where
19 F: Field,
20{
21 fn name(&self) -> &'static str {
22 "Logic OR Gate"
23 }
24 fn q_lc(&self) -> [F; GATE_WIDTH] {
25 [F::one(), F::one(), F::zero(), F::zero()]
26 }
27 fn q_mul(&self) -> [F; N_MUL_SELECTORS] {
28 [-F::one(), F::zero()]
29 }
30 fn q_c(&self) -> F {
31 -F::one()
32 }
33}
34
35#[derive(Clone)]
37pub struct LogicOrOutputGate;
38
39impl<F> Gate<F> for LogicOrOutputGate
40where
41 F: Field,
42{
43 fn name(&self) -> &'static str {
44 "Logic OR Value Gate"
45 }
46 fn q_lc(&self) -> [F; GATE_WIDTH] {
47 [F::one(), F::one(), F::zero(), F::zero()]
48 }
49 fn q_mul(&self) -> [F; N_MUL_SELECTORS] {
50 [-F::one(), F::zero()]
51 }
52 fn q_o(&self) -> F {
53 F::one()
54 }
55}