Good on you for giving Japanese a go!
Ya, Japanese and English are very different, structurally, and some of what's happening in Japanese makes more sense if you know some of the history (well, English has those bits too, as do most languages, for that matter 😉), so I'll give you short answers, and then a fuller explanation. 😄
The short of it
... is the で in ではありません there for the same reason? Is it there just to make ありません polite?
No. The で in ではありません is a separate word. The politeness comes from the ません ending on ありません.
Is で a part of ありません?
No, see above.
... or is it there because it's following a noun? Why is it there?
Yes. More on that in the longer explanation below.
And on that note, correct me if I'm wrong, but contextually I'm assuming いません is for actions and ありません is for things not performing actions.
Broadly speaking, yes, this is a good initial understanding.
Am I even headed vaguely in the right direction or am I completely misunderstanding everything?
Sounds like you've got a good start, for the most part. 😄👍
The long of it
To really explain what's going on takes some doing. Let's dive in.
Part 1: The で in ではありません
私は医者ではありません and 私は教師です
Now, I know that the です part is to indicate politeness, is the で in ではありません there for the same reason? Is it there just to make ありません polite?
The で is not there "just to make ありません polite". :) The ます (positive) and ません (negative) verb endings are the polite parts here.
The で in ではありません (and in the so-called "plain form" ではない, also seen as contracted form じゃない) is, technically speaking, best thought of as the conjunctive form ("[VERB], and [whatever comes next]") of the modern copula ("to be" verb). The polite form of the copula is です, and the plain form is だ.
The modern だ・です copula in Japanese is a synthetic word -- it was basically cobbled together from disparate dialectal variations in the late 1800s as part of the nation-building efforts during the Meiji period. Due in part to this synthetic origin, the modern copula is irregular, and it doesn't conjugate fully. While other verbs have explicit negative forms (like plain する has しない, and polite します has しません), the copula だ・です doesn't have a negative, per se -- instead, we have to use the conjunctive form of the copula (this で) and then add the otherwise-distinct word ない ("there isn't; not", which inflects like any other -i adjective) for the plain form, or ありません ("there isn't; not") for the polite form.
What is that は doing there?
When we negate a statement (when we say that X isn't Y), we are often saying that X isn't Y in contrast to what X actually is. Due to this underlying contrastive nuance, in Japanese, we often add the particle は into this mix. This は particle is usually explained in introductory grammars as the particle used to mark the topic of a statement, and it is also used to introduce a contrast. So instead of just で + ない or ありません, we get で + は + ない・ありません.
A note about the copula
Above, I describe だ・です as the "modern copula". In older stages of the Japanese language, the main copula (again, that's the "to be" verb) was ある・あります -- or, classically speaking, あり. Nowadays, ある・あります is usually used to mean "there is something (in a place, by a person, etc.)", expressing the existence of something in a specific context, rather than just "to be / is". That said, the original very basic "to be" copular meaning still shows up to some extent in modern Japanese, such as in the ありません part ("is not") of polite-form ではありません.
I wrote a longer post explaining だ・です and its relationship to あり over here, in answer to the question, "「です」, what is it really? Is my analysis correct?"
Is で a part of ありません, or is it there because it's following a noun? Why is it there?
Put simply:
No, the で is not part of ありません: this で is a separate verb, the modern copula だ (plain form) and です (polite form), in the conjunctive conjugation.
Yes, it is there because it is following a noun. To say that "X is Y", that one noun (or noun phrase) is another noun (or noun phrase), you need the copula to equate the two. To negate the copula, you need to conjugate the copula into the conjunctive form, and then add the separate piece ない (plain form) or ありません (polite form).
Part 2: ~て・~で + いません
The ~て ending for verbs is the so-called conjunctive form, much like we saw above with で as the conjunctive form for the copula だ・です.
In English, your basic conjunction is "and" -- "A, and B..."
In Japanese, the -te form is the main conjunction for verbs.
You ask about verbs ending in ~で as well. This is ultimately a shift from ~て due to a kind of phonetic contraction.
- Historically, older forms of Japanese were more regular than the modern language, and the conjunctive forms for all verbs ended in ~て. You would convert verb into the -te form by adding this as a suffix to the verb base conjugated as the so-called 連用形【れんようけい】 -- literally the 連【れん】 "attaches, connects to" + 用【よう】 "inflecting" (short for 用言【ようげん】, "inflecting word") + 形【けい】 "form", or the "form for connecting to an inflecting word" (suffixes like conjunctive ~て and polite ~ます are historically treated as inflecting words). In modern educational materials written in English about the Japanese language, this is often introduced as the "masu stem", since this is the form of the verb base used to add the ~ます stem indicating polite register. The masu stem for よむ ("to read") is よみ~, so in older Japanese, the conjunctive form of よむ ("to read") was よみて. Likewise, およぐ ("to swim") became およぎ~, and the conjunctive form was およぎて.
- Due to sound shifts over time, those verbs where the masu stem ends in -i, and where the preceding consonant is //m//, //b//, //n//, or //g//, the -i vowel elided (dropped out), and the nasality of the consonant abbreviated to just the ん sound and caused the following -te suffix to voice to -de instead.
So よみて or yomite shifted to something like yomte, then to yonde. And およぎて or oyogite shifted to something like oyogte, then to oyonde. Etc., etc.
- Note that this ~で after verb stems is not the same thing as the copular で.
Although they both serve a similar grammatical function (both indicate a conjunction, "this AND that"), and although they both derive in part from the same original piece (see Old Japanese completion-aspect suffix つ if you're really interested), the copular で and the verb suffix ~で are different things.
Part 3: いません vs. ありません
...I'm assuming いません is for actions and ありません is for things not performing actions. Context: The ありません was used in the sentence, "I am not a doctor", and the いません was used in the sentence, "They are not sleeping".
Broadly, this is correct -- います (positive) and いません (negative) are used after the conjunctive ~て form of a non-copular verb describing an action or state, and あります (positive) and ありません (negative) are used after the conjunctive で form of the copula describing existence.
There are also statements where a noun is followed by the topic particle は or the subject particle が, and then either of these verbs. This is used to state that something simply exists, that "there is XYZ", rather than to state that one thing is another thing.
→ It's important to note that, in modern Japanese, there's the wrinkle that いる・います is used for describing the existence of a person or other animate objects capable of intent (like cats or dogs or hamsters), while ある・あります is used for describing the existence of inanimate objects incapable of intent (like books or pillows or houses).
Whether you use で or は・が changes the meanings too.
A couple examples might help.
- ✔ 本【ほん】があります。 → "There is a book." → describes the existence of a book.
- ✖ 本【ほん】がいます。 → *"There is a book." → bad grammar, since a book is inanimate and cannot have intent. Listeners will probably be able to understand this, but will find it weird: this makes it sound like the book has animacy.
- ✔ 本【ほん】であります。 → "[It] is a book." → describes the existence of "it" as a book.
- ✖ 本【ほん】でいます。 → *"[It] is a book." → bad grammar, since the "it" that is a book is inanimate and cannot have intent. Listeners will probably be able to understand this, but will find it weird. If the implied topic in this context is a person, this sentence might be understandable as "[the unstated person] is being a book", which is a weird statement, but maybe a bit better grammatically? 😄
I hope the above helps. If you find anything confusing, please comment and I can try to address any remaining question marks.