#![cfg_attr(feature = "parse", doc = "```")]
#![cfg_attr(not(feature = "parse"), doc = "```ignore")]
use super::notation::{Step, flush, walk};
use super::{Drawable, Form};
use crate::hash::{HashMap, HashSet};
use crate::linear::occurrences::{Forest, OccId};
use crate::linear::proofs::{Derivation, InfId, Rule};
use crate::linear::sequents::{Sequent, Stop, Stops, Term, TermId};
use crate::{Error, linear::Mode};
use std::fmt::Write;
use thiserror::Error;
mod deduxit;
pub const NANOYALLA: &str = "1.1.3";
#[non_exhaustive]
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serialize", serde(default, deny_unknown_fields))]
pub struct Options {
pub form: Form,
pub lemma: Identifier,
pub prelude: Option<String>,
pub kernel: Option<Kernel>,
}
impl Default for Options {
fn default() -> Self {
Self {
form: Form::Fragment,
lemma: Identifier::new("certificate").expect("an identifier"),
prelude: None,
kernel: None,
}
}
}
impl Options {
#[must_use]
pub fn with_form(self, form: Form) -> Self {
Self { form, ..self }
}
#[must_use]
pub fn with_lemma(self, lemma: Identifier) -> Self {
Self { lemma, ..self }
}
#[must_use]
pub fn with_prelude(self, prelude: Option<String>) -> Self {
Self { prelude, ..self }
}
#[must_use]
pub fn with_kernel(self, kernel: Option<Kernel>) -> Self {
Self { kernel, ..self }
}
}
#[non_exhaustive]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serialize", serde(rename_all = "lowercase"))]
pub enum Kernel {
NanoYalla,
#[cfg_attr(feature = "serialize", serde(alias = "linlog"))]
Deduxit,
}
pub const DEDUXIT: &str = "0.4.0";
pub const DEDUXIT_PRELUDE: &str = "From Stdlib Require Import List String.
From Deduxit.Linear Require Import Soundness.
Import ListNotations.
Open Scope string_scope.";
pub const DEDUXIT_TWO_SIDED_PRELUDE: &str = "From Stdlib Require Import List String.
From Deduxit.Linear Require Import IntuitionisticCheck.
Import ListNotations.
Open Scope string_scope.";
pub const DEDUXIT_FIRST_ORDER_PRELUDE: &str = "From Stdlib Require Import List String.
From Deduxit.Linear Require Calculus.
From Deduxit.Linear Require Import FirstOrderSoundness.
Import ListNotations.
Open Scope string_scope.";
pub const DEDUXIT_FIRST_ORDER_TWO_SIDED_PRELUDE: &str = "From Stdlib Require Import List String.
From Deduxit.Linear Require Intuitionistic.
From Deduxit.Linear Require Import FirstOrderIntuitionisticCheck.
Import ListNotations.
Open Scope string_scope.";
pub const DEDUXIT_REFUTATION_PRELUDE: &str = "From Stdlib Require Import List String ZArith.
From Deduxit.Linear Require Import Weights.
Import ListNotations.
Open Scope string_scope.";
pub const DEDUXIT_FIRST_ORDER_REFUTATION_PRELUDE: &str =
"From Stdlib Require Import Bool List String ZArith.
From Deduxit.Linear Require Calculus Intuitionistic TermsCheck.
From Deduxit.Linear Require Import FirstOrderCalculus FirstOrderIntuitionistic FirstOrderWeights.
Import ListNotations.
Open Scope string_scope.";
pub const DEDUXIT_KRIPKE_PRELUDE: &str = "From Stdlib Require Import List String.
From Deduxit.Intuitionistic Require Import KripkeCheck.
Import ListNotations.
Open Scope string_scope.";
pub const NANOYALLA_PRELUDE: &str = "From NanoYalla Require Import macroll.";
pub const CLASSICAL_PRELUDE: &str = "From Stdlib Require Import Classical_Prop.";
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct Identifier(Box<str>);
impl Identifier {
pub fn new(name: &str) -> Result<Self, Error> {
let mut chars = name.chars();
let lexical = chars
.next()
.is_some_and(|c| c.is_ascii_alphabetic() || c == '_')
&& chars.all(|c| c.is_ascii_alphanumeric() || c == '_' || c == '\'');
let why = if !lexical {
"is no Rocq identifier: an ASCII letter or _, then letters, digits, _ and '"
} else if KEYWORDS.contains(&name) {
"is a keyword of Rocq"
} else {
return Ok(Self(name.into()));
};
Err(Error::InvalidOption {
key: "rocq.lemma",
message: format!("`{name}` {why}"),
})
}
pub fn as_str(&self) -> &str {
&self.0
}
}
impl std::str::FromStr for Identifier {
type Err = Error;
fn from_str(name: &str) -> Result<Self, Error> {
Self::new(name)
}
}
impl std::fmt::Display for Identifier {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(&self.0)
}
}
#[cfg(feature = "serialize")]
impl serde::Serialize for Identifier {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
serializer.serialize_str(&self.0)
}
}
#[cfg(feature = "serialize")]
impl<'a> serde::Deserialize<'a> for Identifier {
fn deserialize<D: serde::Deserializer<'a>>(deserializer: D) -> Result<Self, D::Error> {
let name = <std::borrow::Cow<'a, str>>::deserialize(deserializer)?;
Self::new(&name).map_err(serde::de::Error::custom)
}
}
#[non_exhaustive]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Error)]
#[cfg_attr(
feature = "serialize",
derive(serde::Serialize),
serde(rename_all = "snake_case")
)]
pub enum Unsupported {
#[error("the proof is not finished: an open goal has no certificate")]
Open,
#[error("NanoYalla has no Mix rule, so a proof with Mix has no certificate")]
Mix,
#[error(
"NanoYalla's kernel has no cut rule, so a proof with a cut has its certificate in deduxit's library"
)]
Cut,
#[error(
"NanoYalla weakens ? formulas only, so a proof with the weakening of affine mode has no certificate"
)]
AffineWeakening,
#[error(
"a compact derivation names one formula of a run of structural rules, so it has no certificate: build the derivation with every rule"
)]
Compact,
#[error(
"NanoYalla's kernel states derivations only, so a refutation has its certificate in deduxit's library"
)]
Disproof,
#[error(
"only a classical assignment that falsifies the sequent certifies that it is not valid, and its image's refutation is none"
)]
NotValid,
#[error(
"the Rocq calculi are commutative, so a derivation or a disproof of the cyclic mode has no certificate"
)]
Ordered,
#[error(
"deduxit's library has no theorem for a saturated set, so a refutation by one has no certificate in Rocq"
)]
Saturated,
#[error(
"NanoYalla's kernel and deduxit's theorem of the count equation have no quantifiers, so a sequent with ∀ or ∃ has a certificate for deduxit's library only, and no refutation by the count equation"
)]
Quantifiers,
#[error(
"an exhausted search states no invariant, so only the search rules the proofs out and Rocq has nothing to check"
)]
Exhausted,
#[error(
"deduxit's library has no theorem for the basis of a backward search, so a refutation by one has no certificate in Rocq"
)]
Basis,
#[error(
"the Rocq kernels know their own calculi, so a derivation in a calculus given as data has no certificate"
)]
Calculus,
}
pub(crate) const KEYWORDS: &[&str] = &[
"_",
"Axiom",
"CoFixpoint",
"Definition",
"Fixpoint",
"Hypothesis",
"IF",
"Lemma",
"Parameter",
"Proof",
"Prop",
"Qed",
"SProp",
"Set",
"Theorem",
"Type",
"Variable",
"as",
"at",
"by",
"cofix",
"discriminated",
"else",
"end",
"exists",
"exists2",
"fix",
"for",
"forall",
"fun",
"if",
"in",
"lazymatch",
"let",
"match",
"multimatch",
"return",
"then",
"using",
"where",
"with",
];
const KERNEL: &[&str] = &[
"Atom",
"app",
"aplus",
"apply",
"awith",
"ax_expansion",
"ax_r_ext",
"bidual",
"bot",
"bot_r_ext",
"cbn_sequent",
"co_r_ext",
"cons",
"covar",
"de_r_ext",
"dual",
"ex_perm_r",
"ex_transpL",
"formula",
"list",
"ll",
"map",
"nat",
"nil",
"O",
"oc",
"oc_r_ext",
"one",
"one_r_ext",
"parr",
"parr_r_ext",
"permL_of_perm",
"plus_r1_ext",
"plus_r2_ext",
"S",
"tens",
"tens_r_ext",
"top",
"top_r_ext",
"var",
"with_r_ext",
"wk_r_ext",
"wn",
"zero",
];
fn identifier(name: &str) -> String {
let mut out = String::with_capacity(name.len());
if name.starts_with(|c: char| c.is_ascii_digit() || c == '\'') {
out.push('_');
}
for c in name.chars() {
if c.is_ascii_alphanumeric() || c == '_' || c == '\'' {
out.push(c);
} else {
write!(out, "_{:x}_", c as u32).unwrap();
}
}
if out.is_empty() {
out.push('_');
}
out
}
pub(crate) fn identifiers(atoms: &[String], lemma: &str) -> Vec<String> {
let mut names: Vec<String> = Vec::with_capacity(atoms.len());
let mut taken: HashSet<String> = HashSet::default();
let mut clashes: HashMap<String, u32> = HashMap::default();
for name in atoms {
let base = identifier(name);
let free = |id: &str, taken: &HashSet<String>| {
!KEYWORDS.contains(&id) && !KERNEL.contains(&id) && id != lemma && !taken.contains(id)
};
let mut id = base.clone();
if !free(&id, &taken) {
let suffix = clashes.entry(base.clone()).or_insert(0);
loop {
*suffix += 1;
id = match *suffix {
1 => format!("{base}'"),
n => format!("{base}'{n}"),
};
if free(&id, &taken) {
break;
}
}
}
taken.insert(id.clone());
names.push(id);
}
names
}
fn term(out: &mut String, sequent: &Sequent, names: &[String], id: TermId, argument: bool) {
use Term::*;
for visit in Stops::new(id, argument, |k| sequent.term(k).operands()) {
match visit {
Stop::Enter(k, argument) => {
let t = sequent.term(k);
if argument && !matches!(t, Atom(_) | One | Bot | Top | Zero) {
out.push('(');
}
match t {
Atom(a) => out.push_str(&names[a.index()]),
DualAtom(a) => {
out.push_str("dual ");
out.push_str(&names[a.index()]);
if argument {
out.push(')');
}
}
One => out.push_str("one"),
Bot => out.push_str("bot"),
Top => out.push_str("top"),
Zero => out.push_str("zero"),
Tensor(..) => out.push_str("tens "),
Par(..) => out.push_str("parr "),
With(..) => out.push_str("awith "),
Plus(..) => out.push_str("aplus "),
Bang(_) => out.push_str("oc "),
Quest(_) => out.push_str("wn "),
Forall(_) | Exists(_) => {
unreachable!("NanoYalla's certificate refuses a sequent with a binder")
}
}
}
Stop::Between(_) => out.push(' '),
Stop::Exit(_, argument) => {
if argument {
out.push(')');
}
}
}
}
}
fn list(out: &mut String, forest: &Forest, names: &[String], occurrences: &[OccId]) {
out.push('[');
for (i, &o) in occurrences.iter().enumerate() {
if i > 0 {
out.push_str("; ");
}
term(out, forest.sequent(), names, forest.term(o), false);
}
out.push(']');
}
struct Script<'a> {
derivation: &'a Derivation<'a>,
forest: &'a Forest,
names: Vec<String>,
out: String,
goals: Vec<Vec<OccId>>,
braced: Vec<bool>,
depth: usize,
}
impl Script<'_> {
fn line(&mut self, text: &str) {
for _ in 0..self.depth {
self.out.push_str(" ");
}
self.out.push_str(text);
self.out.push('\n');
}
fn apply(&mut self, rule: &str, arguments: &[String], leaf: bool) {
let mut text = format!("apply ({rule}");
for a in arguments {
text.push(' ');
text.push_str(a);
}
text.push(')');
text.push_str(if leaf { "." } else { "; cbn_sequent." });
self.line(&text);
}
fn list(&self, occurrences: &[OccId]) -> String {
let mut out = String::new();
list(&mut out, self.forest, &self.names, occurrences);
out
}
fn inference(&mut self, id: InfId, goal: Vec<OccId>) {
let (derivation, forest) = (self.derivation, self.forest);
let inference = derivation.inference(id);
let rule = inference.rule.rule;
if rule == Rule::Ax {
self.line("ax_expansion.");
return;
}
let o = inference.sequent[inference.principal.unwrap()];
let at = goal.iter().position(|&x| x == o.occ()).unwrap();
let (before, after) = (&goal[..at], &goal[at + 1..]);
let prefix = self.list(before);
let (left, right) = (forest.left(o.occ()), forest.right(o.occ()));
let replaced = |with: &[OccId]| {
let mut up = Vec::with_capacity(goal.len() + 1);
up.extend_from_slice(before);
up.extend_from_slice(with);
up.extend_from_slice(after);
up
};
let premise = |script: &mut Self, up: Vec<OccId>| {
script.goals[inference.premises[0].index()] = up;
};
match rule {
Rule::Forall | Rule::Exists => unreachable!("NanoYalla's certificate refuses a binder"),
Rule::One => self.line("apply one_r_ext."),
Rule::Top => self.apply("top_r_ext", &[prefix], true),
Rule::Bot => {
self.apply("bot_r_ext", &[prefix], false);
premise(self, replaced(&[]));
}
Rule::Par => {
self.apply("parr_r_ext", &[prefix], false);
premise(self, replaced(&[left.unwrap(), right.unwrap()]));
}
Rule::PlusLeft => {
self.apply("plus_r1_ext", &[prefix], false);
premise(self, replaced(&[left.unwrap()]));
}
Rule::PlusRight => {
self.apply("plus_r2_ext", &[prefix], false);
premise(self, replaced(&[right.unwrap()]));
}
Rule::Dereliction => {
self.apply("de_r_ext", &[prefix], false);
premise(self, replaced(&[left.unwrap()]));
}
Rule::Weakening => {
self.apply("wk_r_ext", &[prefix], false);
premise(self, replaced(&[]));
}
Rule::Contraction => {
self.apply("co_r_ext", &[prefix], false);
premise(self, replaced(&[o.occ(), o.occ()]));
}
Rule::Promotion => {
let under: Vec<OccId> = before
.iter()
.chain(after)
.map(|&q| forest.left(q).unwrap())
.collect();
let (l1, l2) = under.split_at(before.len());
let mut a = String::from("(");
term(
&mut a,
forest.sequent(),
&self.names,
forest.term(left.unwrap()),
false,
);
a.push(')');
let arguments = [self.list(l1), a, self.list(l2)];
self.apply("oc_r_ext", &arguments, false);
premise(self, replaced(&[left.unwrap()]));
}
Rule::With => {
self.apply("with_r_ext", &[prefix], false);
let (l, r) = (inference.premises[0], inference.premises[1]);
self.goals[l.index()] = replaced(&[left.unwrap()]);
self.goals[r.index()] = replaced(&[right.unwrap()]);
self.braced[l.index()] = true;
self.braced[r.index()] = true;
}
Rule::Tensor => self.tensor(id, goal),
Rule::Ax | Rule::Mix | Rule::AffineWeakening | Rule::Cut | Rule::Open => {
unreachable!("refused before anything is written")
}
}
}
fn tensor(&mut self, id: InfId, goal: Vec<OccId>) {
let (derivation, forest) = (self.derivation, self.forest);
let inference = derivation.inference(id);
let o = inference.sequent[inference.principal.unwrap()];
let (a, b) = (
forest.left(o.occ()).unwrap(),
forest.right(o.occ()).unwrap(),
);
let (l, r) = (inference.premises[0], inference.premises[1]);
let mut left: Vec<OccId> = derivation
.inference(l)
.sequent
.iter()
.map(|m| m.occ())
.collect();
left.remove(left.iter().position(|&x| x == a).unwrap());
let (mut before, mut after) = (Vec::new(), Vec::new());
let mut principal = false;
for &x in &goal {
if x == o.occ() && !principal {
principal = true;
} else if let Some(i) = left.iter().position(|&y| y == x) {
left.remove(i);
before.push(x);
} else {
after.push(x);
}
}
let mut target = before.clone();
target.push(o.occ());
target.extend_from_slice(&after);
if target != goal {
let mut used = vec![false; target.len()];
let p: Vec<String> = goal
.iter()
.map(|&x| {
let j = (0..target.len())
.find(|&j| !used[j] && target[j] == x)
.unwrap();
used[j] = true;
j.to_string()
})
.collect();
let arguments = [format!("[{}]", p.join("; ")), self.list(&target)];
self.apply("ex_perm_r", &arguments, true);
}
let prefix = self.list(&before);
self.apply("tens_r_ext", &[prefix], false);
before.push(a);
after.insert(0, b);
self.goals[l.index()] = before;
self.goals[r.index()] = after;
self.braced[l.index()] = true;
self.braced[r.index()] = true;
}
}
pub fn write<'a>(
derivation: impl Into<Drawable<'a>>,
options: &Options,
out: &mut impl Write,
stop: impl FnMut(crate::limits::Progress) -> bool,
) -> Result<(), Error> {
let stop = crate::limits::counting(stop, crate::limits::Phase::Write);
match derivation.into() {
Drawable::Linear(derivation) => linear(derivation, options, out, stop),
Drawable::Ordinary(derivation) => {
crate::ordinary::rocq::write(derivation, options, out, stop)
}
Drawable::Classical(view) => linear(view.derivation(), options, out, stop),
#[cfg(feature = "serialize")]
Drawable::Rules(_) | Drawable::Fitch(_) => Err(Unsupported::Calculus.into()),
}
}
pub fn to_string<'a>(
derivation: impl Into<Drawable<'a>>,
options: &Options,
) -> Result<String, Error> {
let mut out = String::new();
write(derivation, options, &mut out, |_| false)?;
Ok(out)
}
#[cfg_attr(feature = "parse", doc = "```")]
#[cfg_attr(not(feature = "parse"), doc = "```ignore")]
pub fn write_disproof(
disproof: &crate::linear::Disproof,
options: &Options,
out: &mut impl Write,
) -> Result<(), Error> {
if options.kernel == Some(Kernel::NanoYalla) {
return Err(Unsupported::Disproof.into());
}
if disproof.mode().is_ordered() {
return Err(Unsupported::Ordered.into());
}
if let crate::linear::search::Refutation::Saturated(_) = disproof.refutation() {
return Err(Unsupported::Saturated.into());
}
if let crate::linear::search::Refutation::Basis(_) = disproof.refutation() {
return Err(Unsupported::Basis.into());
}
if let crate::linear::search::Refutation::Exhausted = disproof.refutation() {
return Err(Unsupported::Exhausted.into());
}
deduxit::disproof(disproof, options, out)
}
pub fn write_not_valid(
image: &crate::ordinary::Image,
disproof: &crate::linear::Disproof,
options: &Options,
out: &mut impl Write,
) -> Result<(), Error> {
crate::ordinary::rocq::not_valid(image, disproof, options, out)
}
#[cfg_attr(all(feature = "parse", feature = "sat"), doc = "```")]
#[cfg_attr(not(all(feature = "parse", feature = "sat")), doc = "```ignore")]
pub fn write_countermodel(
countermodel: &crate::ordinary::Countermodel,
logic: crate::ordinary::Logic,
options: &Options,
limits: &crate::Limits,
out: &mut impl Write,
stop: impl FnMut(crate::limits::Progress) -> bool,
) -> Result<(), Error> {
crate::ordinary::rocq::countermodel(countermodel, logic, options, limits, out, stop)
}
fn linear(
derivation: &Derivation,
options: &Options,
out: &mut impl Write,
stop: impl FnMut() -> bool,
) -> Result<(), Error> {
if derivation.is_of_goal() {
return Err(Error::GoalProof);
}
if derivation.mode().is_some_and(Mode::is_ordered) {
return Err(Unsupported::Ordered.into());
}
let uses = |rule| derivation.inferences().iter().any(|i| i.rule.rule == rule);
let (mix, weakening, cut) = (
uses(Rule::Mix),
uses(Rule::AffineWeakening),
uses(Rule::Cut),
);
let mode = derivation.mode();
let binders = derivation.forest().has_binders();
let kernel = options.kernel.unwrap_or(match mode {
Some(mode) if mode.is_intuitionistic() || mode.is_affine() || mode.has_mix() => {
Kernel::Deduxit
}
_ if mix
|| weakening
|| cut
|| binders
|| (mode.is_none() && derivation.reading().is_some()) =>
{
Kernel::Deduxit
}
_ => Kernel::NanoYalla,
});
match kernel {
Kernel::NanoYalla if binders => Err(Unsupported::Quantifiers.into()),
Kernel::NanoYalla => nanoyalla(derivation, options, out, stop),
Kernel::Deduxit => {
let calculus = deduxit::Calculus {
mix: mix || mode.is_some_and(Mode::has_mix),
weakening: weakening || mode.is_some_and(Mode::is_affine),
cut,
};
deduxit::write(derivation, options, calculus, out, stop)
}
}
}
fn nanoyalla(
derivation: &Derivation,
options: &Options,
out: &mut impl Write,
mut stop: impl FnMut() -> bool,
) -> Result<(), Error> {
for inference in derivation.inferences() {
if inference.times > 1 {
return Err(Unsupported::Compact.into());
}
match inference.rule.rule {
Rule::Open => return Err(Unsupported::Open.into()),
Rule::Mix => return Err(Unsupported::Mix.into()),
Rule::AffineWeakening => return Err(Unsupported::AffineWeakening.into()),
Rule::Cut => return Err(Unsupported::Cut.into()),
Rule::Forall | Rule::Exists => return Err(Unsupported::Quantifiers.into()),
Rule::Ax
| Rule::Tensor
| Rule::Par
| Rule::One
| Rule::Bot
| Rule::With
| Rule::PlusLeft
| Rule::PlusRight
| Rule::Top
| Rule::Promotion
| Rule::Dereliction
| Rule::Contraction
| Rule::Weakening => {}
}
}
let forest = derivation.forest();
let names = identifiers(forest.sequent().atom_names(), options.lemma.as_str());
let count = derivation.inferences().len();
let mut script = Script {
derivation,
forest,
names,
out: String::new(),
goals: vec![Vec::new(); count],
braced: vec![false; count],
depth: 0,
};
let root = derivation.root();
script.goals[root.index()] = derivation
.inference(root)
.sequent
.iter()
.map(|m| m.occ())
.collect();
if options.form == Form::Standalone {
let prelude = options.prelude.as_deref().unwrap_or(NANOYALLA_PRELUDE);
write!(out, "{}\n\n", prelude.trim_end())?;
}
write!(script.out, "Lemma {}", options.lemma)?;
if !script.names.is_empty() {
write!(script.out, " ({} : formula)", script.names.join(" "))?;
}
script.out.push_str(" : ll ");
let conclusion = script.list(&script.goals[root.index()]);
script.out.push_str(&conclusion);
script.out.push_str(".\nProof.\n");
walk(derivation, |step| {
match step {
Step::Enter(id, _) => {
if script.braced[id.index()] {
script.line("{");
script.depth += 1;
}
let goal = std::mem::take(&mut script.goals[id.index()]);
script.inference(id, goal);
}
Step::Exit(id, _) => {
if script.braced[id.index()] {
script.depth -= 1;
script.line("}");
}
}
}
flush(out, &mut script.out, &mut stop)
})?;
out.write_str("Qed.")?;
Ok(())
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn names_become_identifiers() {
for (name, expected) in [
("A", "A"),
("x_1", "x_1"),
("p'", "p'"),
("1a", "_1a"),
("α", "_3b1_"),
("a b", "a_20_b"),
("", "_"),
] {
assert_eq!(identifier(name), expected, "{name:?}");
}
let atoms: Vec<String> = ["tens", "with", "certificate", "α", "_3b1_", "_"]
.map(String::from)
.into();
assert_eq!(
identifiers(&atoms, "certificate"),
["tens'", "with'", "certificate'", "_3b1_", "_3b1_'", "_'"]
);
let atoms: Vec<String> = ["ää", "ä_e4_", "_e4_ä", "_e4__e4_"]
.map(String::from)
.into();
assert_eq!(
identifiers(&atoms, "certificate"),
["_e4__e4_", "_e4__e4_'", "_e4__e4_'2", "_e4__e4_'3"]
);
}
}