proof environment as a child of example?

54 views
Skip to first unread message

Andrew Cooper

unread,
Jan 9, 2023, 8:51:48 PM1/9/23
to PreTeXt support
Hi all.

I'm working on some analysis notes, and I'd like to be able to include a <proof> environment inside <example>. This is a pretty typical and expositionally natural thing to do if the proof is relatively short, as in

<example>
<statement>
<me>\inf (-2,3) = -2</me>
</statement>
<proof>
</proof>
</example>

(Technically this is a mathematical result that could be a <proposiiton> or a <lemma>, but in terms of exposition it makes more sense to think of it as an example.)

I know I can hack around this by renaming some otherwise unused mathematical result environment but given that proofs inside of examples are common enough in textbooks I've read, it seems like a feature that other folks might like to have as well.

Rob Beezer

unread,
Jan 10, 2023, 12:23:01 PM1/10/23
to pretext...@googlegroups.com
Dear Andrew,

Thanks for making this suggestion.


> given that proofs inside of examples are common enough in textbooks I've read

I must be reading the wrong books.  I can't recall ever seeing this.  ;-)

Seriously: an "example" (and friends) is much like an "exercise", in that it admits hint, answer, and/or solution.  But these cannot be knowled and do not migrate to solutions (e.g., back of the book), as they are considered expository.

"theorem" (and friends) are defined by the possibility of a "proof" instead, plus one or two other differences.

Thinking overnight, it would be a logistical nightmare to blend the two.  Some options.

1.  Rename a "theorem-like" as you suggest.

2.  Consistently avoid "hint", "answer", or "solution" throughout your project.  Then rename one of these as "Proof".  It will not be able to be knowled (if I remember right).

3.  We support a "proof" *inside* a hint, answer or solution.  These are also limited, as part of the compromise that led to their creation.  Just some light formatting of a heading.  A bit awkward since the proof is a child of something else. Open the "Solution" here to see one in action.

Exercise 4.7: An Inline Exercise
https://pretextbook.org/examples/sample-article/html/interesting-corollary.html#inline-exercise

I suspect (3) is not documented.  If this is a common desire, it would be good to summarize these three options in our main documentation.

Rob

--
You received this message because you are subscribed to the Google Groups "PreTeXt support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-suppo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/39cadeb4-f8a3-4010-9c54-113a03fd2e98n%40googlegroups.com.

Andrew Cooper

unread,
Jan 10, 2023, 4:25:34 PM1/10/23
to PreTeXt support
My only wish is to be able to include, in a set-off way, a proof that the example actually is an example of what I claim it is. I'll use renamed "answer", since I only ever use "hint" and "solution".

Oscar Levin

unread,
Jan 10, 2023, 10:37:43 PM1/10/23
to PreTeXt support
Thinking about this has made me appreciate again how helpful PreTeXt is at making us think about writing well by enforcing semantic structure on us.  What do you want an example of?  There are a few cases that might require a proof:

1. "An example of a non-abelian group is S_3".  This is a true mathematical fact, which perhaps would be better stated as "S_3 is a non-abelian group", which is a proposition that can have a proof.  
2. "Prove that S_3 is a non-abelian group".  This is an example of a type of problem that an algebra student might be asked to do.  Many textbooks (mine included) take the approach that math is about learning to solve math problems (about doing mathematics) rather than about learning which mathematical statements are true, so their examples are examples of problems to solve, and include the solution to that problem.  In this case, it is the solution to the example problem that would include a proof.  And PreTeXt can do that.
3. For textbooks that present math as a set of true statements, then perhaps they would state some general theorem about all numbers with some property being the order of a non-abelian group.  Then they would illustrate this theorem with an example, and as part of that example, justify that the example is an instance of the theorem.  This doesn't seem like something you need a proof for, just a justification as part of the example.

But what else? Can an example be "true"?  If not, then what would a proof of an example be? 

Here is another question: can you give an example of a theorem?  How would you typeset that?  Can you give an example of statement and a "proof" that contains an error (and in fact it must because the statement is false)?  I'm asking for a friend.

Stephen Flood

unread,
Jan 11, 2023, 9:03:41 AM1/11/23
to PreTeXt support
Hello Oscar,

This is an interesting point.  But I'm not sure I understand your last few questions.  One of the things students need to learn is the difference between a lemma, proposition, and theorem.  And one way of teaching this difference is by giving examples of each, so it seems perfectly logical to start to write <example><theorem></theorem></example> (even though the visual studio code will now warn me that this is incorrect).

Now I might have previously defined a theorem to be a particularly interesting or beautiful result that also has a mathematical proof.  So again I can imagine thinking that my example should include both (1) an explanation of why the result is important/beautiful and (2) a proof of this result.  But again, VSC will now warn me if I put a proof environment in the wrong place. 

After this experiment, I've realized that I can't use pretext to directly translate my meaning into environments in the way that automatically comes to mind.  That forces me to do one of two things (1) change what I want to say or (2) start to get creative about how to implement these in pretext.  Your suggestions seem to give interesting ways of doing these two options.  Going from "example of theorem" to "theorem" would (in this hypothetical) change the meaning of what I am saying, but might be tolerable.  But I could also do other things, like using a descriptive list with three titled items: statement, aesthetics, proof.  Now I have my desired structure, but at the loss of the structure and features that I have come to appreciate from pretext (like knowling the proof to emphasize the statement and beauty on the first read).

A similar example could be given for an example environment that includes (1) a statement, (2) an explanation of why it's false, and (3) a purported but incorrect proof.  It would be nice to be able to knowl the incorrect proof so that students can convince themself that the statement is indeed false before exposing them to the "proof", since that might help motivate them to find the mistake.  
 
Anyway, sorry for the long response.  I hope this helps your friend!

David W. Farmer

unread,
Jan 11, 2023, 9:40:56 AM1/11/23
to PreTeXt support

An option is:

------

<paragraphs>
<title>An example of a theorem</title>

<p>
some words go here
</p>

<theorem>
...
</theorem>

<p>
more words go here
</p>

</paragraphs>

------

The "paragraphs" element is like an un-numbered sub-sub-section
which can go in many places.

I could elaborate on Oscar's point about structure, and whether
or not providing an example of a theorem is actually an "example"
in the PreTeXt sense, but maybe the suggestion about "paragraphs"
will make something satisfactory to you.

David
> https://groups.google.com/d/msgid/pretext-support/9007d0bf-516b-4fe8-a75e-c1d5df80e971n%40googlegroups.com.
>
>

Mitch Keller

unread,
Jan 11, 2023, 9:45:29 AM1/11/23
to pretext...@googlegroups.com
I think David’s suggestion is good, and I will also note that since examples are numbered, it would be rather odd looking (and to think about) to have a theorem inside an example.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/2f6db42e-de5e-6e4e-1c38-7b6fac817e9%40aimath.org.

--
Mitch Keller
mi...@rellek.net

http://www.rellek.net/

Stephen Flood

unread,
Jan 11, 2023, 10:11:39 AM1/11/23
to PreTeXt support
Thanks for your thoughtful response.  It is clear that pretext is a well designed language, and that the developers have a clear vision of the syntax and semantics of mathematical writing in particular, and expository writing in general.  And even though many of the specific environments are quite restrictive, there are a large number of workarounds like paragraphs and tasks. 

But I am particularly interested by your comments about structure, and the idea that there is a such a thing as the PreTeXt sense of what an "example" is.  Is there a place to learn more about the semantics/philosophy that underlies the implementation of the different PreTeXt environments?

What I mean is this.  The syntax of the language is clearly defined throughout the documentation and in the schema.  The schema in particular describes exactly how elements can be combined, but does not in itself provide any information about what the meaning of each element should be.  But the documentation is also somewhat vague about the intended semantics of the environments.  The section on Example-like environments says 
PreTeXt provides three closely-related tags for things that are examples or similar. They are <example>, <problem>, and <question>. They all have the same syntax.
The remainder of the section discusses the relevant syntax.

But is there an intended semantics for Example-like environments that helps the new user understand which syntactic combinations have been permitted and which have been excluded?  Or is the intended semantics anything that can be coded using the proper syntax for an Example?   Of course, this question also applies to many other environments for which every mathematician has their own internal semantics which may or may not align with the intended PreTeXt semantics.


Thanks again

David W. Farmer

unread,
Jan 11, 2023, 10:41:44 AM1/11/23
to PreTeXt support

The philosophy of what is meant by various environments has not been
written down yet. In particular, the documentation does not explain how
to think about what should go in an "example", for example.

A particularly common issue is to use lists wherever LaTeX would
use a list. In a sequence of exercises, for instance. Probably that
is mentioned somewhere, but putting that in a new "philosophy of
document structure, as viewed in PreTeXt" would be nice.

I think this conversation is useful, and it would be good to improve
the documentation. I think it would help to have a preliminary start
to that description, even if it was horribly incomplete.

Off the top of my head:

"An 'example' should include an instance of a concept presented in the
text, with the expectation that the same concept would appear in
several different examples. Examples can have hints, answers, and
solutions."

That at least explains why I don't see "an example of a theorem" as
something which should go in an 'example'.
> https://groups.google.com/d/msgid/pretext-support/47484e24-2024-48e7-b83a-77aca53a8be8n%40googlegroups.com.
>
>

arech...@gmail.com

unread,
Jan 11, 2023, 7:16:11 PM1/11/23
to PreTeXt support
I'm late to the party here... but for our PLP text we really did want proofs inside examples (and exercise solutions) - since the main aim of text (and the associated course)  is "Students learn to prove stuff" - so a huge portion of the examples and exercises are of the form "Prove this mathematical thingy" and then the body of the example (or "scratch work in the solution") is some blurb explaining about how to explore your way to the proof, and then "we write it up properly" and stick it in a proof environment. We really want to make the "scratch work / exploration" distinct from the formal proof.

Oscar Levin

unread,
Jan 11, 2023, 9:16:43 PM1/11/23
to pretext...@googlegroups.com
That is very much what I do in my proofs sections.  And this is an instance of an example being an example of a thing you can *do*.  Prove this statement.  What is the solution to this problem?  It is the scratch work, followed by the proof.  So both of those go inside a solution.  

On Wed, Jan 11, 2023, 5:16 PM arech...@gmail.com <arech...@gmail.com> wrote:
I'm late to the party here... but for our PLP text we really did want proofs inside examples (and exercise solutions) - since the main aim of text (and the associated course)  is "Students learn to prove stuff" - so a huge portion of the examples and exercises are of the form "Prove this mathematical thingy" and then the body of the example (or "scratch work in the solution") is some blurb explaining about how to explore your way to the proof, and then "we write it up properly" and stick it in a proof environment. We really want to make the "scratch work / exploration" distinct from the formal proof.

--
You received this message because you are subscribed to the Google Groups "PreTeXt support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-suppo...@googlegroups.com.

Rob Beezer

unread,
Jan 13, 2023, 12:32:08 PM1/13/23
to pretext...@googlegroups.com
Yes, it will be good someday to document the purpose of certain blocks, as reflected in their names.  Pity those who are not writing in English...  But there are huge logistical gaps in the documentation that need work before we have that luxury.

In this case an "example" is a worked-out exercise.  An expository exercise.  As Oscar said, something to do.  So it has hint, answer, solution, but they don't hide and they don't migrate.

You can put a (minimally formatted) "proof" inside the solutions, to support asking a student to do a proof.

I'll reiterate that I may never understand putting a flawed argument inside something labeled "Proof".  So I added three or four alternatives.  Hijack "justification" and rename it to "Ad-Hominen Argument" if you must.  I think there are enough tools available to satisfy most situations.

For those who think these distinctions are important and useful, mining this thread to improve the documentation of "example" and "proof" would be a very welcome PR.

Rob

Reply all
Reply to author
Forward
0 new messages