open Fields
module N = Nat

module Fq =
  Make_fp
    (N)
    (struct
      let order =
        N.of_string
          "41898490967918953402344214791240637128170709919953949071783502921025352812571106773058893763790338921418070971888253786114353726529584385201591605722013126468931404347949840543007986327743462853720628051692141265303114721689601"
    end)

let non_residue = Fq.of_int 13

module Fq2 = struct
  module Params = struct
    let non_residue = non_residue
  end

  include Make_fp2 (Fq) (Params)
end

module Fq4 = struct
  module Params = struct
    let frobenius_coeffs_c1 =
      [| Fq.of_string "1"
       ; Fq.of_string
           "18691656569803771296244054523431852464958959799019013859007259692542121208304602539555350517075508287829753932558576476751900235650227380562700444433662761577027341858128610410779088384480737679672900770810745291515010467307990"
       ; Fq.of_string
           "41898490967918953402344214791240637128170709919953949071783502921025352812571106773058893763790338921418070971888253786114353726529584385201591605722013126468931404347949840543007986327743462853720628051692141265303114721689600"
       ; Fq.of_string
           "23206834398115182106100160267808784663211750120934935212776243228483231604266504233503543246714830633588317039329677309362453490879357004638891167538350364891904062489821230132228897943262725174047727280881395973788104254381611"
      |]

    let non_residue = Fq.(zero, one)
  end

  include Fields.Make_fp2 (Fq2) (Params)
end

module G1 = struct
  module Params = struct
    let a = Fq.of_string "2"

    let b =
      Fq.of_string
        "28798803903456388891410036793299405764940372360099938340752576406393880372126970068421383312482853541572780087363938442377933706865252053507077543420534380486492786626556269083255657125025963825610840222568694137138741554679540"
  end

  include Elliptic_curve.Make (N) (Fq) (Params)

  let one =
    of_affine_coordinates
      ( Fq.of_string
          "23803503838482697364219212396100314255266282256287758532210460958670711284501374254909249084643549104668878996224193897061976788052185662569738774028756446662400954817676947337090686257134874703224133183061214213216866019444443"
      , Fq.of_string
          "21091012152938225813050540665280291929032924333518476279110711148670464794818544820522390295209715531901248676888544060590943737249563733104806697968779796610374994498702698840169538725164956072726942500665132927942037078135054"
      )
end

module G2 = struct
  module Params = struct
    let a = Fq.(G1.Params.a * non_residue, zero)

    let b = Fq.(zero, G1.Params.b * non_residue)
  end

  include Elliptic_curve.Make (N) (Fq2) (Params)

  let one =
    of_affine_coordinates
      Fq.
        ( ( of_string
              "22367666623321080720060256844679369841450849258634485122226826668687008928557241162389052587294939105987791589807198701072089850184203060629036090027206884547397819080026926412256978135536735656049173059573120822105654153939204"
          , of_string
              "19674349354065582663569886390557105215375764356464013910804136534831880915742161945711267871023918136941472003751075703860943205026648847064247080124670799190998395234694182621794580160576822167228187443851233972049521455293042"
          )
        , ( of_string
              "6945425020677398967988875731588951175743495235863391886533295045397037605326535330657361771765903175481062759367498970743022872494546449436815843306838794729313050998681159000579427733029709987073254733976366326071957733646574"
          , of_string
              "17406100775489352738678485154027036191618283163679980195193677896785273172506466216232026037788788436442188057889820014276378772936042638717710384987239430912364681046070625200474931975266875995282055499803236813013874788622488"
          ) )
end

module Pairing_info = struct
  let twist = Fq.(zero, one)

  let loop_count =
    N.of_string
      "204691208819330962009469868104636132783269696790011977400223898462431810102935615891307667367766898917669754470400"

  let is_loop_count_neg = true

  let final_exponent =
    N.of_string
      "73552111470802397192299133782080682301728710523587802164414953272757803714910813694725910843025422137965798141904448425397132210312763036419196981551382130855705368355580393262211100095907456271531280742739919708794230272306800896198050256355512255795343046414500439648235407402928016221629661971660368018858492377211675996627011913832155809286572006511506918479348970121218134056996473102963627909657625079190739882316882751992741238799066378820181352081085141743775089602078041985556107852922590029377522580702957164527112688206145822971278968699082020672631957410786162945929223941353438866102009621402205679750863679130426460044792078113778548067020007452390228240608175718400"

  let final_exponent_last_chunk_abs_of_w0 =
    N.of_string
      "204691208819330962009469868104636132783269696790011977400223898462431810102935615891307667367766898917669754470399"

  let final_exponent_last_chunk_is_w0_neg = true

  let final_exponent_last_chunk_w1 = N.of_string "1"
end

open Fields
module N = Nat

module Fq =
  Make_fp
    (N)
    (struct
      let order =
        N.of_string
          "41898490967918953402344214791240637128170709919953949071783502921025352812571106773058893763790338921418070971888253786114353726529584385201591605722013126468931404347949840543007986327743462853720628051692141265303114721689601"
    end)

let non_residue = Fq.of_int 13

module Fq2 = struct
  module Params = struct
    let non_residue = non_residue
  end

  include Make_fp2 (Fq) (Params)
end

module Fq4 = struct
  module Params = struct
    let frobenius_coeffs_c1 =
      [| Fq.of_string "1"
       ; Fq.of_string
           "18691656569803771296244054523431852464958959799019013859007259692542121208304602539555350517075508287829753932558576476751900235650227380562700444433662761577027341858128610410779088384480737679672900770810745291515010467307990"
       ; Fq.of_string
           "41898490967918953402344214791240637128170709919953949071783502921025352812571106773058893763790338921418070971888253786114353726529584385201591605722013126468931404347949840543007986327743462853720628051692141265303114721689600"
       ; Fq.of_string
           "23206834398115182106100160267808784663211750120934935212776243228483231604266504233503543246714830633588317039329677309362453490879357004638891167538350364891904062489821230132228897943262725174047727280881395973788104254381611"
      |]

    let non_residue = Fq.(zero, one)
  end

  include Fields.Make_fp2 (Fq2) (Params)
end

module G1 = struct
  module Params = struct
    let a = Fq.of_string "2"

    let b =
      Fq.of_string
        "28798803903456388891410036793299405764940372360099938340752576406393880372126970068421383312482853541572780087363938442377933706865252053507077543420534380486492786626556269083255657125025963825610840222568694137138741554679540"
  end

  include Elliptic_curve.Make (N) (Fq) (Params)

  let one =
    of_affine_coordinates
      ( Fq.of_string
          "23803503838482697364219212396100314255266282256287758532210460958670711284501374254909249084643549104668878996224193897061976788052185662569738774028756446662400954817676947337090686257134874703224133183061214213216866019444443"
      , Fq.of_string
          "21091012152938225813050540665280291929032924333518476279110711148670464794818544820522390295209715531901248676888544060590943737249563733104806697968779796610374994498702698840169538725164956072726942500665132927942037078135054"
      )
end

module G2 = struct
  module Params = struct
    let a = Fq.(G1.Params.a * non_residue, zero)

    let b = Fq.(zero, G1.Params.b * non_residue)
  end

  include Elliptic_curve.Make (N) (Fq2) (Params)

  let one =
    of_affine_coordinates
      Fq.
        ( ( of_string
              "22367666623321080720060256844679369841450849258634485122226826668687008928557241162389052587294939105987791589807198701072089850184203060629036090027206884547397819080026926412256978135536735656049173059573120822105654153939204"
          , of_string
              "19674349354065582663569886390557105215375764356464013910804136534831880915742161945711267871023918136941472003751075703860943205026648847064247080124670799190998395234694182621794580160576822167228187443851233972049521455293042"
          )
        , ( of_string
              "6945425020677398967988875731588951175743495235863391886533295045397037605326535330657361771765903175481062759367498970743022872494546449436815843306838794729313050998681159000579427733029709987073254733976366326071957733646574"
          , of_string
              "17406100775489352738678485154027036191618283163679980195193677896785273172506466216232026037788788436442188057889820014276378772936042638717710384987239430912364681046070625200474931975266875995282055499803236813013874788622488"
          ) )
end

module Pairing_info = struct
  let twist = Fq.(zero, one)

  let loop_count =
    N.of_string
      "204691208819330962009469868104636132783269696790011977400223898462431810102935615891307667367766898917669754470400"

  let is_loop_count_neg = true

  let final_exponent =
    N.of_string
      "73552111470802397192299133782080682301728710523587802164414953272757803714910813694725910843025422137965798141904448425397132210312763036419196981551382130855705368355580393262211100095907456271531280742739919708794230272306800896198050256355512255795343046414500439648235407402928016221629661971660368018858492377211675996627011913832155809286572006511506918479348970121218134056996473102963627909657625079190739882316882751992741238799066378820181352081085141743775089602078041985556107852922590029377522580702957164527112688206145822971278968699082020672631957410786162945929223941353438866102009621402205679750863679130426460044792078113778548067020007452390228240608175718400"

  let final_exponent_last_chunk_abs_of_w0 =
    N.of_string
      "204691208819330962009469868104636132783269696790011977400223898462431810102935615891307667367766898917669754470399"

  let final_exponent_last_chunk_is_w0_neg = true

  let final_exponent_last_chunk_w1 = N.of_string "1"
end
