Skip to content

Swampland Conjectures

Kay Lehnert edited this page Feb 17, 2026 · 26 revisions

To assess the swampland conjectures, we computed a few additional quantities and made those available through the Python wrapper classy. The swampland conjectures are explained in the thesis and in more detail in the Hitchhiker's Guide to the Swampland. Here, we focus on the technical implementation.

We added various new variables:

  • $\phi_i$

that are implemented as follows:

background.h

    short attractor_ic_scf;                         /**< whether the scalar field has attractor initial conditions */
    double phi_ini_scf_computed;                    /**< computed initial \f$ \phi \f$ actually used after attractor/NaN checks */
    double phi_prime_scf_computed;                  /**< computed initial \f$ d\phi/d\tau \f$ actually used after attractor/NaN checks */
    double phi_scf_min;                             /**< minimum \f$ \phi \f$ encountered over the background table */
    double phi_scf_max;                             /**< maximum \f$ \phi \f$ encountered over the background table */
    double phi_scf_range;                           /**< \f$ \phi_{max}-\phi_{min} \f$ over the background table */
    double dV_V_scf_min;                            /**< minimum \f$ |dV/d\phi|/V \f$ encountered over the background table (de Sitter Conjecture) */
    double ddV_V_scf_max;                           /**< maximum \f$ d^2V/d\phi^2/V \f$ encountered over the background table (second de Sitter Conjecture) */
    double ddV_V_at_dV_V_min;                       /**< \f$ d^2V/d\phi^2/V \f$ evaluated when \f$ |dV/d\phi|/V \f$ reaches its minimum */
    double dV_V_at_ddV_V_max;                       /**< \f$ |dV/d\phi|/V \f$ evaluated when \f$ d^2V/d\phi^2/V \f$ reaches its maximum */
    double swgc_expr_min;                           /**< minimum of \f$ 2(d^3V/d\phi^3)^2 - (d^2V/d\phi^2)(d^4V/d\phi^4) - (d^2V/d\phi^2)^2 \f$ (scalar weak gravity conjecture) */
    double sswgc_min;                               /**< minimum of the strong scalar weak gravity conjecture expression \f$ M_P^2 m^2 \partial_\phi^2(1/m^2) \f$ */
    double AdSDC2_max;                              /**< maximum of AdSDC2 boundary expression during evolution */
    double AdSDC4_max;                              /**< maximum of AdSDC4 boundary expression during evolution */
    double combined_dSC_min;                        /**< minimum of \f$ (3(dV_p)^2/V^2 - 2 d^2V/d\phi^2/V)/4 \f$ during evolution, a strong form of a combined de Sitter conjecture, stemming from the FLB and the SSWGC. */
    int attractor_regime_scf;                       /**< attractor regime used: 0=no attractor, 1=large-field, 2=approximate, 3=small-field, 4=approximate small-field */

cclassy.pxd

        double phi_ini_scf_computed
        double phi_prime_scf_computed
        double phi_scf_min
        double phi_scf_max
        double phi_scf_range
        double dV_V_scf_min
        double ddV_V_scf_max
        double ddV_V_at_dV_V_min
        double dV_V_at_ddV_V_max
        double swgc_expr_min
        double sswgc_min
        double AdSDC2_max
        double AdSDC4_max
        double combined_dSC_min
        int attractor_regime_scf

classy.pyx

            elif name == 'phi_ini_scf_ic':
                value = self.ba.phi_ini_scf_computed
            elif name == 'phi_prime_scf_ic':
                value = self.ba.phi_prime_scf_computed
            elif name == 'phi_scf_min':
                value = self.ba.phi_scf_min
            elif name == 'phi_scf_max':
                value = self.ba.phi_scf_max
            elif name == 'phi_scf_range':
                value = self.ba.phi_scf_range
            elif name == 'dV_V_scf_min':
                value = self.ba.dV_V_scf_min
            elif name == 'ddV_V_scf_max':
                value = self.ba.ddV_V_scf_max
            elif name == 'ddV_V_at_dV_V_min':
                value = self.ba.ddV_V_at_dV_V_min
            elif name == 'dV_V_at_ddV_V_max':
                value = self.ba.dV_V_at_ddV_V_max
            elif name == 'swgc_expr_min':
                value = self.ba.swgc_expr_min
            elif name == 'sswgc_min':
                value = self.ba.sswgc_min
            elif name == 'AdSDC2_max':
                value = self.ba.AdSDC2_max
            elif name == 'AdSDC4_max':
                value = self.ba.AdSDC4_max
            elif name == 'combined_dSC_min':
                value = self.ba.combined_dSC_min
            elif name == 'attractor_regime_scf':
                value = self.ba.attractor_regime_scf

The swampland constraints hold at all times. Therefore, we check for the minimum and maximum values of the various swampland parameters that are reached during the cosmological evolution. These extremal values are extracted at the very end, after the cosmological run, and extracted from the background table that stores the individual values at each time step. There are other quantities that are retrieved in this manner, e.g. the conformal age. To profit from synergies and allowing the compiler to unroll a single for-loop in a vectorised way using modern CPU instruction sets, we implemented the retrieval of the extremal swampland values as follows in background_solve() in background.c:

  if (pba->has_scf == _FALSE_)
  {
    pba->phi_scf_min = 0.0;
    pba->phi_scf_max = 0.0;
    pba->phi_scf_range = 0.0;
    pba->dV_V_scf_min = 0.0;
    pba->ddV_V_scf_max = 0.0;
    pba->ddV_V_at_dV_V_min = 0.0;
    pba->dV_V_at_ddV_V_max = 0.0;
    pba->swgc_expr_min = 0.0;
    pba->sswgc_min = 0.0;
    pba->AdSDC2_max = 0.0;
    pba->AdSDC4_max = 0.0;
    pba->combined_dSC_min = 0.0;
  }

. . .

  /** - In a single fused loop over lines, fill the rest of the
      background table for quantities that depend on "conformal_age"
      or "D_today" (computed just above), AND compute all scalar
      field swampland diagnostic quantities (min/max reductions).
      Fusing both passes into one loop improves cache locality
      since each table row is only loaded from memory once. */
  {
    /** Number of rows in the background table */
    int num_bg_rows = pba->bt_size;
    /** Number of columns per row (stride between consecutive rows) */
    int cols_per_row = pba->bg_size;
    /** Reciprocal of the growth factor today, used to normalise D(a) */
    double inv_D_today = 1.0 / D_today;
    /** Flag: whether scalar field is active and swampland diagnostics are needed */
    int has_scalar_field = (pba->has_scf == _TRUE_);

    /* Pre-cache curvature quantities for comoving radius computation.
       These avoid recomputing sqrt() on every row. */
    /** sqrt(K) for closed geometry (sgnK == +1), 0 otherwise */
    double sqrt_curv_pos = 0.0;
    /** sqrt(-K) for open geometry (sgnK == -1), 0 otherwise */
    double sqrt_curv_neg = 0.0;
    if (pba->sgnK == 1)
      sqrt_curv_pos = sqrt(pba->K);
    else if (pba->sgnK == -1)
      sqrt_curv_neg = sqrt(-pba->K);

    /* ---- SCF column-offset cache and swampland accumulators ----
       These are only meaningful when has_scalar_field is true.
       Initialised to safe sentinel values so they never produce
       spurious results if the scf branch is skipped. */

    /** Column offsets into the strided background table for scalar field quantities */
    int col_phi = 0;     /**< offset for scalar field value phi */
    int col_V = 0;       /**< offset for scalar field potential V */
    int col_dV_pure = 0; /**< offset for pure potential derivative V'_pure (no coupling) */
    int col_ddV = 0;     /**< offset for second derivative V'' */
    int col_d3V = 0;     /**< offset for third derivative V''' */
    int col_d4V = 0;     /**< offset for fourth derivative V'''' */

    /** Whether the dark matter model is interacting (model_cdm==2),
        which activates the SSWGC and AdSDC diagnostics */
    int is_interacting_dm = 0;
    /** Dark matter coupling constant c (from pba->cdm_c) */
    double dm_coupling_c = 0.0;

    /* Running extrema for the scalar field range */
    /** Running minimum of phi across all table rows */
    double phi_running_min = 0.0;
    /** Running maximum of phi across all table rows */
    double phi_running_max = 0.0;

    /* ---- de Sitter Conjecture (dSC) accumulators ---- */
    /** Running minimum of |V'_pure|/V (first de Sitter Conjecture parameter).
        Initialised to +sentinel so any real value wins. */
    double dV_over_V_min = 1.e100;
    /** Running maximum of V''/V (second de Sitter Conjecture parameter).
        Initialised to -sentinel so any real value wins. */
    double ddV_over_V_max = -1.e100;
    /** Value of V''/V at the row where |V'_pure|/V is minimised
        (cross-diagnostic: evaluates second dSC where first dSC is weakest) */
    double ddV_over_V_at_dV_min = -1.e100;
    /** Value of |V'_pure|/V at the row where V''/V is maximised
        (cross-diagnostic: evaluates first dSC where second dSC is strongest) */
    double dV_over_V_at_ddV_max = 1.e100;

    /* ---- Scalar Weak Gravity Conjecture (SWGC) accumulator ---- */
    /** Running minimum of 2(V''')^2 - V''*V'''' - (V'')^2.
        Positive values indicate the SWGC is satisfied.
        Initialised to +sentinel so any real value wins. */
    double swgc_running_min = 1.e100;

    /* ---- Combined de Sitter Conjecture accumulator ---- */
    /** Running minimum of (3*(V'_pure/V)^2 - 2*V''/V)/4.
        This combined bound comes from the FLB and SSWGC.
        Initialised to +sentinel so any real value wins. */
    double combined_dSC_running_min = 1.e100;

    /* ---- Strong Scalar WGC (SSWGC) accumulator ---- */
    /** Running minimum of the SSWGC expression: M_P^2 m^2 d^2(1/m^2)/dphi^2.
        Only meaningful for interacting DM (model_cdm==2). */
    double sswgc_running_min = 1.e100;

    /* ---- Anti-de Sitter Distance Conjecture (AdSDC) accumulators ---- */
    /** Running maximum of (1-tanh(c*phi))/|V|^{1/2}  (AdSDC with exponent 1/2) */
    double AdSDC2_running_max = 0.0;
    /** Running maximum of (1-tanh(c*phi))/|V|^{1/4}  (AdSDC with exponent 1/4) */
    double AdSDC4_running_max = 0.0;

    if (has_scalar_field)
    {
      /* Cache column offsets from the background struct */
      col_phi = pba->index_bg_phi_scf;
      col_V = pba->index_bg_V_scf;
      col_dV_pure = pba->index_bg_dV_p_scf;
      col_ddV = pba->index_bg_ddV_scf;
      col_d3V = pba->index_bg_d3V_scf;
      col_d4V = pba->index_bg_d4V_scf;

      is_interacting_dm = (pba->model_cdm == 2);
      dm_coupling_c = pba->cdm_c;

      /* Seed all accumulators from the first row (i==0) of the table,
         so the main loop can start comparisons from i==1. */
      double *first_row = pba->background_table;
      double phi_seed = first_row[col_phi];     /**< phi at earliest time in table */
      double V_seed = first_row[col_V];         /**< V(phi) at earliest time */
      double dVp_seed = first_row[col_dV_pure]; /**< V'_pure at earliest time */
      double ddV_seed = first_row[col_ddV];     /**< V'' at earliest time */
      double d3V_seed = first_row[col_d3V];     /**< V''' at earliest time */
      double d4V_seed = first_row[col_d4V];     /**< V'''' at earliest time */

      phi_running_min = phi_seed;
      phi_running_max = phi_seed;

      if (V_seed != 0.0)
      {
        double inv_V_seed = 1.0 / V_seed;
        dV_over_V_min = fabs(dVp_seed) * inv_V_seed;
        ddV_over_V_max = ddV_seed * inv_V_seed;
        ddV_over_V_at_dV_min = ddV_over_V_max;
        dV_over_V_at_ddV_max = dV_over_V_min;
        swgc_running_min = 2.0 * d3V_seed * d3V_seed - ddV_seed * d4V_seed - ddV_seed * ddV_seed;
        double dVp_over_V_seed = dVp_seed * inv_V_seed;
        combined_dSC_running_min = 0.25 * (3.0 * dVp_over_V_seed * dVp_over_V_seed - 2.0 * ddV_over_V_max);
      }

      if (is_interacting_dm)
      {
        double c_times_phi_seed = dm_coupling_c * phi_seed;
        double tanh_seed = tanh(c_times_phi_seed);
        double cosh_seed = cosh(c_times_phi_seed);
        /** SSWGC expression: 2*c^2 * [4*(1+tanh(c*phi)) - sech^2(c*phi)] */
        sswgc_running_min = 2.0 * dm_coupling_c * dm_coupling_c * (4.0 * (1.0 + tanh_seed) - 1.0 / (cosh_seed * cosh_seed));
        double abs_V_seed = fabs(V_seed);
        double sqrt_abs_V_seed = sqrt(abs_V_seed);
        double one_minus_tanh_seed = 1.0 - tanh_seed;
        AdSDC2_running_max = one_minus_tanh_seed / sqrt_abs_V_seed;
        AdSDC4_running_max = one_minus_tanh_seed / sqrt(sqrt_abs_V_seed);
      }
    }

    /* ---- Main fused loop over all rows of the background table ---- */
    for (int i = 0; i < num_bg_rows; i++)
    {
      double *row = pba->background_table + i * cols_per_row;

      /* --- Part 1: Growth factor normalisation and distance computation ---
         Normalise D(a) by D_today so that D(a_today)=1, then compute
         conformal distance, comoving radius and angular/luminosity distances. */
      row[pba->index_bg_D] *= inv_D_today;

      conformal_distance = pba->conformal_age - pba->tau_table[i];
      row[pba->index_bg_conf_distance] = conformal_distance;

      if (pba->sgnK == 0)
        comoving_radius = conformal_distance;
      else if (pba->sgnK == 1)
        comoving_radius = sin(sqrt_curv_pos * conformal_distance) / sqrt_curv_pos;
      else /* sgnK == -1 */
        comoving_radius = sinh(sqrt_curv_neg * conformal_distance) / sqrt_curv_neg;

      /** 1 + z for this row, used for angular/luminosity distance */
      double one_plus_z = 1.0 + pba->z_table[i];
      row[pba->index_bg_ang_distance] = comoving_radius / one_plus_z;
      row[pba->index_bg_lum_distance] = comoving_radius * one_plus_z;

      /* --- Part 2: Scalar field swampland diagnostics ---
         Row 0 was already used to seed the accumulators above,
         so comparisons start from row 1 onwards. */
      if (has_scalar_field && i > 0)
      {
        /** Scalar field value at this time step */
        double phi = row[col_phi];
        /** Scalar field potential V(phi) at this time step */
        double V = row[col_V];
        /** Pure potential derivative V'_pure(phi) (without coupling to DM) */
        double dV_pure = row[col_dV_pure];
        /** Second derivative V''(phi) */
        double V_second_deriv = row[col_ddV];
        /** Third derivative V'''(phi) */
        double V_third_deriv = row[col_d3V];
        /** Fourth derivative V''''(phi) */
        double V_fourth_deriv = row[col_d4V];

        /* Update running phi range */
        if (phi < phi_running_min)
          phi_running_min = phi;
        if (phi > phi_running_max)
          phi_running_max = phi;

        /* V-dependent Swampland diagnostics (skip if V==0 to avoid division) */
        if (V != 0.0)
        {
          double inv_V = 1.0 / V;

          /** |V'_pure|/V for the first de Sitter Conjecture */
          double dV_over_V = fabs(dV_pure) * inv_V;
          /** V''/V for the second de Sitter Conjecture */
          double ddV_over_V = V_second_deriv * inv_V;

          /* Track minimum of |V'|/V and record V''/V at that point */
          if (dV_over_V < dV_over_V_min)
          {
            dV_over_V_min = dV_over_V;
            ddV_over_V_at_dV_min = ddV_over_V;
          }
          /* Track maximum of V''/V and record |V'|/V at that point */
          if (ddV_over_V > ddV_over_V_max)
          {
            ddV_over_V_max = ddV_over_V;
            dV_over_V_at_ddV_max = dV_over_V;
          }

          /** SWGC expression: 2*(V''')^2 - V''*V'''' - (V'')^2 */
          double swgc_expr = 2.0 * V_third_deriv * V_third_deriv - V_second_deriv * V_fourth_deriv - V_second_deriv * V_second_deriv;
          if (swgc_expr < swgc_running_min)
            swgc_running_min = swgc_expr;

          /** V'_pure/V ratio for the combined dSC bound
              (read directly from table — no dV_p_scf() call needed) */
          double dVp_over_V = dV_pure * inv_V;
          /** Combined dSC: (3*(V'/V)^2 - 2*V''/V) / 4 */
          double combined_dSC_expr = 0.25 * (3.0 * dVp_over_V * dVp_over_V - 2.0 * ddV_over_V);
          if (combined_dSC_expr < combined_dSC_running_min)
            combined_dSC_running_min = combined_dSC_expr;
        }

        /* Interacting-DM-specific diagnostics: SSWGC and AdSDC */
        if (is_interacting_dm)
        {
          /** Argument c*phi for hyperbolic functions */
          double c_times_phi = dm_coupling_c * phi;
          double tanh_c_phi = tanh(c_times_phi);
          double cosh_c_phi = cosh(c_times_phi);

          /** SSWGC expression: 2*c^2 * [4*(1+tanh(c*phi)) - sech^2(c*phi)] */
          double sswgc_expr = 2.0 * dm_coupling_c * dm_coupling_c * (4.0 * (1.0 + tanh_c_phi) - 1.0 / (cosh_c_phi * cosh_c_phi));
          if (sswgc_expr < sswgc_running_min)
            sswgc_running_min = sswgc_expr;

          double abs_V = fabs(V);
          double sqrt_abs_V = sqrt(abs_V);
          /** 1 - tanh(c*phi): measure of distance from the AdS boundary */
          double one_minus_tanh = 1.0 - tanh_c_phi;

          /** AdSDC boundary with exponent 1/2: (1-tanh(c*phi)) / |V|^{1/2} */
          double AdSDC2_expr = one_minus_tanh / sqrt_abs_V;
          if (AdSDC2_expr > AdSDC2_running_max)
            AdSDC2_running_max = AdSDC2_expr;

          /** AdSDC boundary with exponent 1/4: (1-tanh(c*phi)) / |V|^{1/4} */
          double AdSDC4_expr = one_minus_tanh / sqrt(sqrt_abs_V);
          if (AdSDC4_expr > AdSDC4_running_max)
            AdSDC4_running_max = AdSDC4_expr;
        }
      }
    }

    /* Store swampland results into the background struct for the Python wrapper.
       Sentinel values (from rows where V==0 everywhere) are mapped to 0. */
    if (has_scalar_field)
    {
      pba->phi_scf_min = phi_running_min;
      pba->phi_scf_max = phi_running_max;
      pba->phi_scf_range = phi_running_max - phi_running_min;

      pba->dV_V_scf_min = (dV_over_V_min < 1.e99) ? dV_over_V_min : 0.0;
      pba->ddV_V_at_dV_V_min = (dV_over_V_min < 1.e99) ? ddV_over_V_at_dV_min : 0.0;
      pba->ddV_V_scf_max = (ddV_over_V_max > -1.e99) ? ddV_over_V_max : 0.0;
      pba->dV_V_at_ddV_V_max = (ddV_over_V_max > -1.e99) ? dV_over_V_at_ddV_max : 0.0;
      pba->swgc_expr_min = (swgc_running_min < 1.e99) ? swgc_running_min : 0.0;
      pba->sswgc_min = (sswgc_running_min < 1.e99) ? sswgc_running_min : 0.0;
      pba->AdSDC2_max = (AdSDC2_running_max > -1.e99) ? AdSDC2_running_max : 0.0;
      pba->AdSDC4_max = (AdSDC4_running_max > -1.e99) ? AdSDC4_running_max : 0.0;
      pba->combined_dSC_min = (combined_dSC_running_min < 1.e99) ? combined_dSC_running_min : 0.0;
    }
  }

Initial Field Values $\phi_i$

As a cross-check if the correct initial field values are used, I explicitly fetch them from the first entry of the integration vector.

    pba->phi_ini_scf_computed = pvecback_integration[pba->index_bi_phi_scf];
    pba->phi_prime_scf_computed = pvecback_integration[pba->index_bi_phi_prime_scf];
    if (pba->background_verbose > 2)
    {
      printf("[background] attractor_regime_scf=%d, phi_ini_scf_computed=%e, phi_prime_scf_computed=%e\n",
             pba->attractor_regime_scf,
             pba->phi_ini_scf_computed,
             pba->phi_prime_scf_computed);
    }
  }
  else
  {
    pba->phi_ini_scf_computed = 0.0;
    pba->phi_prime_scf_computed = 0.0;
    pba->attractor_regime_scf = 0;
    if (pba->background_verbose > 0)
    {
      printf("No scalar field present. No initial field values set.\n");
    }

The Strong Scalar Weak Gravity Conjecture

$M^2m^2\partial_\phi^2\left(1/m^2\right)=2c^2\left(4\left(1+\tanh\left(c\phi\right)\right)-1/\cosh\left(c\phi\right)^2\right)\geq1$

double sswgc(
    struct background *pba,
    double phi)
{
  if (pba->model_cdm == 2) // Interacting DM model
  {
    double c = pba->cdm_c;
    return 2. * c * c * (4. * (1. + tanh(pba->cdm_c * phi)) - 1. / cosh(pba->cdm_c * phi) / cosh(pba->cdm_c * phi));
  }
  else
    return 0.;
}

Clone this wiki locally