jf_relation/gates/
lookup.rs

1// Copyright (c) 2022 Espresso Systems (espressosys.com)
2// This file is part of the Jellyfish library.
3
4// You should have received a copy of the MIT License
5// along with the Jellyfish library. If not, see <https://mit-license.org/>.
6
7//! Implementation of UltraPlonk lookup gates
8
9use super::Gate;
10use ark_ff::Field;
11
12/// An UltraPlonk lookup gate
13#[derive(Debug, Clone)]
14pub struct LookupGate<F: Field> {
15    pub(crate) q_dom_sep: F,
16    pub(crate) table_dom_sep: F,
17    pub(crate) table_key: F,
18}
19
20impl<F> Gate<F> for LookupGate<F>
21where
22    F: Field,
23{
24    fn name(&self) -> &'static str {
25        "UltraPlonk Lookup Gate"
26    }
27    fn q_lookup(&self) -> F {
28        F::one()
29    }
30    fn q_dom_sep(&self) -> F {
31        self.q_dom_sep
32    }
33    fn table_key(&self) -> F {
34        self.table_key
35    }
36    fn table_dom_sep(&self) -> F {
37        self.table_dom_sep
38    }
39}